获取文件的长度
fseek(stream, 0, SEEK_SET); filelen = ftell(fseek(stream, 0, SEEK_END)); fseek(stream, 0, SEEK_SET);
FILE *stream; char buf[1000]; int filelen; stream=fopen( "c:\\a.txt ", "w+ "); if(NULL == stream) return; fseek(stream, 0, SEEK_SET); filelen = ftell(fseek(stream, 0, SEEK_END)); fseek(stream, 0, SEEK_SET); if(filelen <= sizeof(buff)) fread(buff, filelen, 1, stream); else ...