[C]function feof
#include <stdio.h> #include <string.h> int main(void) { char buffer[16]; int loop = 0; FILE * myfile; myfile = fopen("test_txt","r"); while (!feof(myfile)) { loop++; memset(buffer, 0x00, sizeof(buffer)); fread(buffer, 1,16,myfile); printf("[%d]:%sn", loop,buffer); } fclose(myfile); return 0; }