#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
//格式化
struct std {
char ch[64];
int age;
float source;
};
//int main() {
// struct std s = {"xiaodong",19,87.0};
// FILE* f = fopen("test03.txt", "wb");
// if (f == NULL) {
// perror("fopen");
// return -1;
// }
// fwrite(&s,sizeof(s),1,f);
// fclose(f);
// f = NULL;
// system("pause");
// return 0;
//}
int main() {
struct std s = { 0};
FILE* f = fopen("test03.txt", "rb");
if (f == NULL) {
perror("fopen");
return -1;
}
fread(&s, sizeof(s), 1, f);
printf("%s %d %f", s.ch, s.age, s.source);
fclose(f);
f = NULL;
system("pause");
return 0;
}