is my filename cause my problem?
alright, I'm using linux 9.0 and I'm using the C++ language,
what I need to do is grab input from a user and use that input to open a file.
the way I approached it was to grab the input from the user into a string. (string2)
I then concatenated two strings together to form one string. (string1+=string2)
and when I opened the file I used the command string1.c_str() for the filename.
Fin.open ( string1.c_str(), ios::in );
however, when I'm passing the file to another functions and try to read a line from the file in that function, I get the error message:
Node.cxx:24: invalid use of undefined type `struct std::basic_ifstream<char,
std::char_traits<char> >'
/usr/include/c++/3.2.2/iosfwd:86: declaration of `struct
std::basic_ifstream<char, std::char_traits<char> >'
the line that causes the error is:
Fin.getline ( Kdata, 5, '\n' );
where Fin is the file passed to the function, and Kdata is private data in a record. Kdata is a char array of size 4.
all I'm trying to do is just grab a small line, and put it into
I can't figure out why I'm getting this message, is there a better way to do this,.
|