#include<stdio.h>
#include<stdlib.h>
int main()
{
FILE *fp;
fp=fopen("student.txt","w+");
if(fp==NULL)
{
printf("can not open this file");
exit (0);
}
int m=0,n=1;
fprintf(fp,"%d,%d",m,n);
int a,b;
fscanf(fp,"%d,%d",&a,&b);
fprintf(stdout,"%d\n%d",a,b);
return 0;
}
写完数据请使用fclose(fp)关闭流然后重新读取