When attempting to read a long line with ifstream::getline(), the fist part of the line, up to the limit specified in the call, is correct. Subsequent calls to getline return nothing. The attached source code exposes this bug on all gcc versions that I have tried it on on my Linux box. On other compilers (on Irix, OSF1, HP-UX, and AIX), this program runs as expected. (Returns chunks of the line until the file is finished.) Release: all stdlib++'s that I've tested Environment: Redhat 7.2, gcc 2.96 20000731 (Red Hat Linux 7.1 2.96-98), gcc 3.0.2 20010905 (Red Hat Linux 7.1 3.0.1-3), gcc version 3.1 20020325 (prerelease) How-To-Repeat: Compile the attached code with g++ (one of the versions listed above). Run the executable. The input file name can be changed to any file with long lines.
Responsible-Changed-From-To: unassigned->bkoz Responsible-Changed-Why: Mine.
State-Changed-From-To: open->analyzed State-Changed-Why: Thanks for the clear description, well-designed test case. I've reproduced this on linux. More shortly..... -benjamin
State-Changed-From-To: analyzed->closed 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