fstream.ignore() bug?

Robert Schweikert rjschwei@mindspring.com
Tue Jan 9 17:24:00 GMT 2001


There appears to be a problem with the ignore method for an fstream when
the end of file is reached, the attached example shows the problem.

-> g++ -DBUG -o bugTes streamTest.C

Now running bugTes leads to an endless loop (stopped artificially by a
counter) not defining BUG during compile shows the work around.

What I expect to happen is that the ignore method ignores extracts the
'\0'  (last line in file), discards it and moves the file pointer to the
EOF, then the next read from the file should fail and the fail bit
should be set, thus my while loop should end. For some reason when using
the ignore method EOF is never reached, this seems incorrect.

Comments, questions help is appreciated.

Thanks,
Robert

--
Robert Schweikert                      MAY THE SOURCE BE WITH YOU
rjschwei@mindspring.com                         LINUX




More information about the Gcc mailing list