我正在 Visual Studio 中编写程序。\n我使用fread和复制了一个文件fwrite。\n输出文件大小比输入文件大。\n你能解释一下原因吗?
#define _CRT_SECURE_NO_WARNINGS\n#include <stdio.h>\n#include <stdlib.h>\n#include <memory.h>\n\nint main()\n{\n char *buffer;\n int fsize;\n\n FILE *fp = fopen("test.txt", "r");\n FILE *ofp = fopen("out.txt", "w");\n fseek(fp, 0, SEEK_END);\n fsize = ftell(fp);\n\n buffer = (char *)malloc(fsize);\n memset(buffer, 0, fsize); // buffer\xeb\xa5\xbc 0\xec\x9c\xbc\xeb\xa1\x9c \xec\xb4\x88\xea\xb8\xb0\xed\x99\x94\n\n fseek(fp, 0, SEEK_SET);\n fread(buffer, fsize, 1, fp);\n\n fwrite(buffer, fsize, 1, ofp);\n\n fclose(fp);\n fclose(ofp);\n free(buffer);\n}\nRun Code Online (Sandbox Code Playgroud)\n