fwrite in C giving different values in output files

后端 未结 3 470
迷失自我
迷失自我 2021-01-24 03:56

why are the output files different when I use fwrite in another function VERSUS fwrite in the same function?

output1.txt contains garbage value like Ê, which is NOT corr

3条回答
  •  忘掉有多难
    2021-01-24 04:18

    In function writeData change

    fwrite(&buf, sizeof(char), strlen(buf), fp1);
    

    to

    fwrite(buf, sizeof(char), strlen(buf), fp1);
    

提交回复
热议问题