大佬教程收集整理的这篇文章主要介绍了C fwrite()写的比预期的要多,大佬教程大佬觉得挺不错的,现在分享给大家,也给大家做个参考。
码:
bool done; FILE* fin; FILE* fout; const int bs = 1024*64;//64 kb char* buffer[bs]; int er,ew,br,bw; long long int size = 0; long long int sizew = 0; er = fopen_s(&fin,s.c_str(),"rb"); ew = fopen_s(&fout,s2.c_str(),"wb"); if(er == 0 && ew == 0){ while(br = fread(buffer,1,bs,fin)){ size += br; sizew += fwrite(buffer,fout); } done = true; }else{ done = false; } if(fin != NULL)fclose(fin); if(fout != NULL)fclose(fout);
以某种方式fwrite写入整个缓冲区忽略计数值(br)
一些例子如何:
Copying 595 file of 635 DONE. 524288/524288 B Copying 596 file of 635 DONE. 524288/524288 B Copying 597 file of 635 DONE. 65536/145 B Copying 598 file of 635 DONE. 65536/16384 B Copying 599 file of 635 DONE. 65536/145 B Copying 600 file of 635 DONE. 65536/67 B Copying 601 file of 635 DONE. 65536/32768 B Copying 602 file of 635 DONE. 65536/67 B
谁知道问题出在哪里?
以上是大佬教程为你收集整理的C fwrite()写的比预期的要多全部内容,希望文章能够帮你解决C fwrite()写的比预期的要多所遇到的程序开发问题。
如果觉得大佬教程网站内容还不错,欢迎将大佬教程推荐给程序员好友。
本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
如您有任何意见或建议可联系处理。小编QQ:384754419,请注明来意。