feof()函数陷阱
先从一个简单的输出开始 一个程序,代码如下: #include<stdio.h> int main() { char buff[1024]; memset(buff, 0, sizeof(buff)); FILE* f = fopen("a.txt", "r"); while (!feof(f)) { printf("---not eof\n"); fgets(buff, sizeof(buff), f); printf("buff is -- %s", buff); } ...
read more