摘要: feof()的实现与平台有关。在stdio.h中feof的定义:#define _IOEOF 0x0010#define feof(_stream) ((_stream)->_flag & _IOEOF)由此可知,只有当fp->_flag & 0x0010为真时,才认为文件结束了。在VC里,只有当file position indicator(在Windows上是fp->_ptr)到了文件末尾,然后再发生读/写操作时,fp->_flag才会被置为含有_IOEOF,然后再调用feof(),才会得到文件结束的信息,并不是file position indic 阅读全文
posted @ 2011-10-21 13:21 only_eVonne 阅读(571) 评论(0) 推荐(0) 编辑
摘要: #include <stdio.h>int fseek(FILE *fp, long offset, int whence);fseek 会调用 lseek,lseek 的功能是修改 file table 中 file 数据结构的 offset(内核层),offset(内核层)的值是由 offset(应用层)和 whence 计算而来。lseek system call has nothing to do with the seek operation that positions a disk arm over a particular disk sector。至此,fseek 阅读全文
posted @ 2011-10-21 13:20 only_eVonne 阅读(907) 评论(0) 推荐(0) 编辑