feof

feof's definition in stdio.h:

#define _IOEOF 0x0010

#define feof(_stream) ((_stream)->_flag & _IOEOF)

From here we know only _flag equal to _IOEOF then feof() return 1. When file position indicator arrive to end of file, and read/write again, the fp->_flag set to _IOEOF, then call feof() will return none zero, that mean not file position indicator arrive end of file, feof() think file end. Mean that only file pointer arrive to the next position of end of file, then feof() return 1.

你可能感兴趣的:(feof)