Mail Archives: djgpp/2000/07/17/20:54:22
ifstream.eof() returns FALSE, although the current position in the file
is EOF. After reading one more byte, ifstream.eof() returns TRUE, but,
of course, ifstream.good() returns FALSE.
example code:
Let's say "test.dat" is a file with a size of exactly 10 Bytes.
ifstream f1("test.dat", ios::in | ios::bin);
unsigned char buffer[10];
f1.read(buffer, 10);
Now, I think, f1.eof() should return TRUE, but it returns FALSE.
f1.read(buffer, 1);
Now, after reading one Byte too much, it returns TRUE.
Thanks for answering,
HST
- Raw text -