Mail Archives: djgpp/1998/11/30/03:31:49
Christian Hofrichter (ChristianHofrichter AT gmx DOT de) wrote:
: I have a problem with "feof" and "fseek".
While it is not clearly documented (at least not in the man pages
I just checked) I think it is true that:
-feof only returns TRUE if the "eof flag" is set;
-the "eof flag" is not set by fseek
-the "eof flatg" IS set by one of the read functions (getchar, getc,
fgetc, gets, fgets, fread, etc) ONLY.
Therefore, what feof tells you is if the most recent **READ OPERATION**
has encountered EOF, not if the current **file position** is at EOF.
If you addd a getc() in your loop, right following the fseek() you'll
see the behavior you expect.
Fred
--
---- Fred Smith -- fredex AT fcshome DOT stoneham DOT ma DOT us -----------------------------
For the wages of sin is death,
but the gift of God is eternal life in Christ Jesus our Lord
------------------------------ Romans 6:23 (niv) ------------------------------
- Raw text -