0
int main(int argc, char **argv)
{
FILE *fe, *fs;
unsigned char buffer[2048];
int bytesreader;
fe = fopen(argv[1], "rb");
fs = fopen(argv[2], "wb");
while((bytesreader = fread(buffer, 1, 2048, fe)))
fwrite(buffer, 1, bytesreader, fs);
fclose(fe);
fclose(fs);
return 0;
}
而且我的錯誤是...複製文件,但誤差雙倍免費或損壞用C
*** glibc detected *** ./doc2: double free or corruption (top): 0x096b7008 ***
對不起,現在是正確的,但我不undertand。我的失敗在哪裏?
什麼是'bytesLeidos'? – glglgl
調皮有argv [1]等而沒有檢查argc的值 – Bathsheba
也調皮不檢查fopen的結果 –