调用磁盘文件问题
typedef struct student /*定义数据结构*/{
char sno[4];
char name[20];
int age;
float score[N];
float toal;
float avg;
struct student *next;
}stu;
/*从文件读取数据*/
stu *load()
{
FILE *fp;
stu *head=NULL,*info=NULL;
char filename[8];
printf("please input the filename!\n");
scanf("%s",filename);
puts(filename);
if((fp=fopen(filename,"r"))==NULL)
{
printf("the file is not exist!\n");
return NULL;
}
if(fread(info,sizeof(stu),1,fp)==1)
{
info->next=head;
head=info;
}
if(feof(fp))
{
fclose(fp);
return head;
}
printf("file read error!");
return NULL;
}
各位帮我看看这个从调用磁盘文件的函数,我在调试到红色字体时就过不了了,跳出的是要么关闭程序,要么调试程序的窗口,各位大哥帮我看看错在哪里,小弟先谢谢了