cin >> a char *, because string doesnt work

Discussion in 'C++' started by iochinome, Aug 28, 2010.

  1. iochinome

    iochinome New Member

    Joined:
    Aug 28, 2010
    Messages:
    1
    Likes Received:
    0
    Trophy Points:
    0
    Hello all,

    I am developing an application using OpenCV that requires the user to specify the name of an image file, which then gets loaded using cvLoadImage ();

    cvLoadImage takes a (char *) as an argument- how do i have the user create one of these? the following code created a segfault:

    IplImage * img;
    char * filename;
    cin >> filename;
    img = cvLoadImage (filename);

    thanks!
     

Share This Page

  1. This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
    By continuing to use this site, you are consenting to our use of cookies.
    Dismiss Notice