我正在尝试从输出文件读取并写入输入文件,但是我的程序运行不正常。我不知道如何解决。我有这个:
int i;
FILE *file;
char filename[500];
printf("Please enter the name of the file you would like to write to\n", &filename);
scanf("%s", filename);
file = fopen(filename, "w");
printf("Writing to file %s\n", filename);
fprintf("%d / %d", *num, *denom);
fclose(file);`
有人可以帮助我了解此代码写入文件在做什么吗?
改变
fprintf("%d / %d", *num, *denom);
到
fprintf(file, "%d / %d", *num, *denom);
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句