各位高手帮看一下哪错了,谢谢
#include <stdio.h>#include <stdlib.h>
void main()
{
int i=3;
float f=6.2;
FILE *fp;
if((fp=fopen("wang.txt","w"))==NULL)
{
printf("can't create file: wang.txt\n");
exit(0);
}
fprintf(fp,"%2d,%6.2f",i,f);
fclose(fp);
if((fp=fopen("wang.txt","r"))==NULL)
{
printf("can't openfile:wang.txt\n");
exit(0);
}
i=0;f=0;
fcanf(fp,"%2d,%6.2f",&i,&f);
fclose(fp);
printf("i=%2d,f=%6f\n",i,f);
}