关于fread()读取二进制文件的问题
程序代码:
void fileOperate_rw(){ char path_1[100] = "D:\\desktop\\第1讲 6.2-6.2.5不局限内存-文件.mp4"; char path_2[100] = "D:\\desktop\\2.mp4"; FILE* pfa = fopen(path_1,"rb"); FILE* pfb = fopen(path_2,"wb"); if(pfa == NULL && pfb == NULL){ printf("error,file not found"); }else{ //fseek(pf1,0,SEEK_END); //int count_file_b = ftell(pf1); char buff[1024] = {0}; int result; while((result = fread(buff,sizeof(buff),1,pfa))!=0){ //printf("%d\n",result); fwrite(buff,sizeof(buff),result,pfb); /*fgets(buff,sizeof(buff),pfa); fputs(buff,pfb);*/ } } fclose(pfa); fclose(pfb); }
如代码所示,在读取MP4文件时,为什么进不去while循环