2
我正在尝试从输出文件读取数据并写入输入文件,但我的程序工作不正常。我不知道如何解决它。我有这样的:如何显示从文件中读取的一部分c
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'是:'INT fprintf中(FILE *流,为const char *格式,...);' – ViniciusArruda