问题描述
- fread读文件不好控制啊
-
如题,
#include
#include
#includestruct S{
char a[100];
};
void addStudent(struct S student)
{
FILE fp;
fp=fopen("Student.dat","rb");
if(fp==NULL)
{
printf(" error exitn");
return;
}
fread(&student,sizeof(struct S),1,fp);
printf("%sn",student.a);
printf("**************************n");
fclose(fp);
}int main()
{
struct S s;
addStudent(s);
return 0;
}
时间: 2024-10-26 11:15:13