fscanf()的问题
用fscanf()读取文件时,文件有146行#include<stdio.h>
#include<stdlib.h>
struct info{
double x;
double y;
double d;
double toa;
}agent[146];
void main()
{
FILE *fp;
int i;
int d_agent[146],toa[146];
fp=fopen("C:\\agent_pos.txt","r");
if(fp==NULL)
{
printf("cannot opent the file \n");
exit(0);
}
for(i=0;i<146;i++)
{
fscanf(fp,"%lf,%lf,%lf,%lf\n",&agent[i].x,&agent[i].y,&d_agent[i],&toa[i]);
printf("%lf,%lf\n",agent[i].x,agent[i].y);
}
fclose(fp);
}
为什么最后一行读不出来呢?请大家指教。