include "StdAfx.h"
#include <stdio.h>
#include<stdlib.h>
int _tmain(void)
{
FILE *fp ;
long num ;
char stname[20];
int i , score;
int avg_score = 0 ;
if((fp = fopen("E:\\f12-1.txt","r")) = NULL)
printf("can not open the file \n");
else
printf("have open the file\n");
for(i = 0 ; i < 5 ; i++)
{
printf("i am tired\n");
//问题就在这,输入的问题
fscanf_s(fp, "%d", &num);
fscanf_s(fp, "%s", &stname, _countof(stname));
fscanf_s(fp, "%d", &score);
printf("have read it\n");
printf("%ld %s %d ",num ,stname , score);
}
if(fclose(fp))
{
printf("can not close the file\n");
exit(0);
}
else
printf("have close the file\n");
return 0;
}
定位了问题在文件的输入上,但是不知道怎么修改