FILE * outfile, *infile, *temp;
outfile = fopen("d:\\copy.bin", "ab+" );
infile = fopen("d:\\tobecalc.bin", "rb");
unsigned char buf[2048];
if( outfile == NULL || infile == NULL )
{
printf("%s %s","tobecalc","not exit\n");
exit(1);
}
int rc;
/*
while( (rc = fread(buf,sizeof(unsigned char),2048,infile)) != 0 )
{
fwrite( buf, sizeof( unsigned char ), rc, outfile );
}
*/
fread(buf,sizeof(unsigned char),2048,infile);
fwrite(buf,sizeof(unsigned char),2048,outfile);
往outfile 這個檔案指標里寫2048個資料,這樣寫為什么沒反應,buf里的資料是讀對了的
uj5u.com熱心網友回復:
我會告訴你們嗎,顯然不會,自己搜去,謝謝自己uj5u.com熱心網友回復:
int _tmain(int argc, _TCHAR* argv[]){
FILE * outfile, *infile, *temp;
unsigned char buf[2048];
infile = fopen("F:\\music\\Smooth.mp3", "rb" );
outfile= fopen("f:\\new_smooth.mp3","wb");
int rc;
while( (rc = fread(buf,sizeof(unsigned char),2048,infile)) != 0 )
{
fwrite( buf, sizeof( unsigned char ), rc, outfile );
}
fread(buf,sizeof(unsigned char),2048,infile);
fwrite(buf,sizeof(unsigned char),2048,outfile);
fclose(infile);
fclose(outfile);
return 0;
}
直接在你代碼上改了改,自己看看
uj5u.com熱心網友回復:
這個原因很多,首先要保證d:\\copy.bin里面有資料并且指標不在檔案尾有時可能重繪延遲,要關閉檔案或重繪資源管理器來看效果
轉載請註明出處,本文鏈接:https://www.uj5u.com/houduan/130052.html
標籤:基礎類
上一篇:菜鳥求助,急~~~
