主题:fscanf读取的问题
#include "stdio.h"
#include "process.h"
void main( )
{
FILE *f;
float a[2][3];
float b[2][3];
float c,d,e;
int i;
a[0][0]=1.0;
a[0][1]=2.0;
a[0][2]=3.0;
a[1][0]=4.0;
a[1][1]=5.0;
a[1][2]=6.0;
if ((f=fopen("c:\\test3.txt","w"))!=NULL)
{ for (i=0;i<2;i++)
fprintf(f,"%10.2f,%10.2f,%10.2f\n",a[i][0],a[i][1],a[i][2]);}
else exit(0);
for (i=0;i<2;i++)
printf("%10.2f,%10.2f,%10.2f\n",a[i][0],a[i][1],a[i][2]);
if ((f=fopen("c:\\test3.txt","r"))!=NULL)
{ for (i=0;i<2;i++)
{fscanf(f,"%10.2f,%10.2f,%10.2f\n",&c,&d,&e);
b[i][0]=c;
b[i][1]=d;
b[i][2]=e;}
}
else
{printf("this file can not open\n");
exit(0);}
fclose(f);
for (i=0;i<2;i++)
printf("%10.2f,%10.2f,%10.2f\n",b[i][0],b[i][1],b[i][2]);
}