到底错在哪??
程序代码:
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); }
根据调试结果来看,fread()读取应该是成功的,但是为什么进不去while循环,无法写入呢?到底错在哪儿