This is the mail archive of the
gcc-bugs@gcc.gnu.org
mailing list for the GCC project.
Re: libstdc++/6238: ifstream::getline(...) has problems reading file after long line.
- From: bkoz at gcc dot gnu dot org
- To: bkoz at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, tabrunn at sandia dot gov
- Date: 9 Apr 2002 19:16:22 -0000
- Subject: Re: libstdc++/6238: ifstream::getline(...) has problems reading file after long line.
- Reply-to: bkoz at gcc dot gnu dot org, bkoz at gcc dot gnu dot org, gcc-bugs at gcc dot gnu dot org, gcc-prs at gcc dot gnu dot org, tabrunn at sandia dot gov, gcc-gnats at gcc dot gnu dot org
Synopsis: ifstream::getline(...) has problems reading file after long line.
State-Changed-From-To: analyzed->closed
State-Changed-By: bkoz
State-Changed-When: Tue Apr 9 12:16:21 2002
State-Changed-Why:
This isn't a bug. The specification for getline says that failbit will be set if n items are read without hitting the delimiter. That's what is happening here.
If you change
while(!infile.eof() && record_count < 200)
to
while(infile.good())
You'll get the results you expect.
-benjamin
http://gcc.gnu.org/cgi-bin/gnatsweb.pl?cmd=view%20audit-trail&database=gcc&pr=6238