kakalake
July 9th, 2002, 06:19 PM
Hello!
I have the following code:
...
std::ifstream strm( fname );
...
strm >> Var1 >> Var2;
...
strm.getline( s, STRING_LENGTH );
The problem is that when i try to read the line 2 of the file with getline then i get nothing, but when i read a char after Vars2 for ex.
strm >> Var1 >> Var2 >> a;
...then i get the first char from the second line. Is there a problem when i mix >> and getline???
After i read the char the function getline reads the string correctly but without the beginning char.
Anyone an idea...
Thanks
I have the following code:
...
std::ifstream strm( fname );
...
strm >> Var1 >> Var2;
...
strm.getline( s, STRING_LENGTH );
The problem is that when i try to read the line 2 of the file with getline then i get nothing, but when i read a char after Vars2 for ex.
strm >> Var1 >> Var2 >> a;
...then i get the first char from the second line. Is there a problem when i mix >> and getline???
After i read the char the function getline reads the string correctly but without the beginning char.
Anyone an idea...
Thanks