with Qt library I've found the feof() implementation. it consist of a macro which test the eof flag in the file stream:
#define feof(__F) ((__F)->_flag & _IOEOF)
where the filebuffer struct is:
1 2 3 4 5 6 7 8 9 10 11
typedefstruct _iobuf
{
char* _ptr;
int _cnt;
char* _base;
int _flag; // <- this is the inspected flag
int _file;
int _charbuf;
int _bufsiz;
char* _tmpfname;
} FILE;
so feof() waits that the reading functions set the file buf EOF- flag to true...that's why it reads a non existing row of the file..