我是C语言的新手,我正在尝试将数据保存到.csv并在一个非常简单的程序中读取相同的数据.
char c;
FILE *fp;
fp = fopen("file.csv", "w+");
fprintf(fp, "Hello;World\nLine");
fclose(fp);
fp = fopen("file.csv", "r");
while (getc(fp) != EOF) {
printf("%c", getc(fp));
}
fclose(fp);
Run Code Online (Sandbox Code Playgroud)
我不知道为什么输出错了:
el;ol
ie
Run Code Online (Sandbox Code Playgroud)
提前致谢