#include <stdio.h>
#include <stdlib.h>
int main ()
{
FILE*fp;
int a;
char b;
float c;
scanf ("%d, %c, %f", &a, &b, &c);
if((fp=fopen("int.txt","w+") )==NULL)
{
printf("cannot open file\n");
exit(0);
}
fprintf(fp,"%d, %c, %f",a,b,c);
rewind(fp);
fclose(fp);
return 0;
}
然而scanf函数运行完就结束了,打不开文件夹
scanf无法进行正常文件写入操作,文件输入输出流中写入文件只有 fscanf, fputc,fputs 三个函数
如有帮助,请点个采纳捏~