2 u011956004 u011956004 于 2014.02.27 22:20 提问

fread读文件不好控制啊

如题,
#include
#include
#include

struct S{
char a[100];
};
void addStudent(struct S student)
{
FILE fp;
fp=fopen("Student.dat","rb");
if(fp==NULL)
{
printf(" error exit\n");
return;
}
fread(&student,sizeof(struct S),1,fp);
printf("%s\n",student.a);
printf("
**************************\n");
fclose(fp);
}

int main()
{
struct S s;
addStudent(s);
return 0;
}

Csdn user default icon
上传中...
上传图片
插入图片