水花DX 2014-02-27 14:20
浏览 899

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;
}

  • 写回答

0条回答 默认 最新

    报告相同问题?