我按照小甲鱼视频打的 为什么还是错误的呢
#include <stdio.h>#include <stdlib.h>
void load();
int main()
{
int i;
load();
for(i=0; i<4;i++)
{
printf("%10s%5d %5d%10s",stu.name,stu.num,stu.age,stu.addr);
}
}
void load()
{
FILE *fp;
int i;
if(!(fp = fopen("student-list1","r")))
{
printf("cannot open the file;\n");
return;
}
for(i=0 i<4;i++)
{
fread(&stu,sizeof(struct student),1,fp);
}
fclose(fp);
}
我怎么看你的fopen打开的文件没有后缀名呢 看上去像是少了个student全局变量结构体
页:
[1]