关于fscanf函数的问题求助
FILE *wj;char filename[100];
printf("请输入要打开的以前信息文件的位置,如c:\\\\temp.txt:");
fflush(stdin);
scanf(" %s",filename);
wj=fopen(filename,"r+");
if ((wj=fopen(filename,"r+"))==NULL)
{
printf("打开文件%s出现错误\n",filename);
return 0;
}
printf("请输入保存了信息的学生的数量:");
scanf("%d",&n);
p=(struct student*)calloc(n,sizeof(struct student));
if(p==NULL)
{
printf("内存不足\n");
exit(0);
}
for(i=0;i<n;i++)
{
fscanf(wj, "%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^,],%[^ ]",(p+i)->studentname,(p+i)->sex,(p+i)->studentid,(p+i)->year,(p+i)->month,(p+i)->day,(p+i)->dizhi,(p+i)->tp,(p+i)->mail);
}
break;
}
TXT文件数据是这样的:
156465,f,231321,12,12634,212,152,1654654,21312313,1345
56456,m,23131,156,156416,2313,215415,123546,213156,1564654
1154,f,12345646,15,1545,321,15,2313,156456,231321
21354,f,545456,2,215,156,156,32132,5456456,231321
在执行fscanf会弹windows窗orz 求助