Getline and 16h (26d) character

Posted by Kra on Stack Overflow See other posts from Stack Overflow or by Kra
Published on 2010-05-29T16:19:56Z Indexed on 2010/05/29 16:32 UTC
Read the original article Hit count: 188

Filed under:
|

Hi,

in VC++ environment Im using (string) getline function to read separate lines in opened file. Problem is that getline takes character 1Ah as end of file and if it is present on the line, whole reading ends prematurely. Is there any solution for this?

Code snippet:

fstream LogFile (Source,fstream::in);
string Line

while (getline(LogFile,Line))
{  ....  }

File contents:

line1text1asdf
line2text2asd //EOF for getline here
line3asdas // this line will never be read by getline

Thank you for any info.

Kra

© Stack Overflow or respective owner

Related posts about c++

Related posts about getline