33. 使用fread()/fwrite()往文件中写入结构体,从文件中读出结构体

  1 //读写结构体
  2 #include 
  3 typedef struct student
  4 {
  5     int num;
  6     char name[30];
  7     char sex;
  8     float math;
  9     float english;
 10     float chinese;
 11 
 12 }Stu;
 13 
 14 Stu s[5] =
 15 {
 16     1001,"wukong",'x',99,99,99,
 17     1002,"songjiang",'x',99,22,11,
 18     1003,"baoyu",'x',79,33,100,
 19     1004,"liudehua",

你可能感兴趣的:(c/c++)