1、文本文件读写
1.1 keywords
FILE *fp
fopen(“D:\test.txt”, a)
fprintf(*fp, “\n%s”, argc)
r
w
a
r+
w+
a+
1.2 eg
typedef struct student
{
char name[20];
int age;
char sex;
}STUDENT;
void file_save(STUDENT *p_stu)
{
FILE *fp;
fp = fopen("D:\\student.txt", a+);
assert(fp != NULL);
fprintf(fp, "\nname: %s", p_stu->name);
fprintf(fp, "\nage: %d", p_stu->age);
fprintf(fp, "\nsex: %c", p_stu->sex);
fclose(fp);
}
```