为什么将数据写入文件的结果是这样
#include<stdio.h>
struct student
{
int number;
char name;
int age;
char sex;
int birthday;
};
void add()
{
FILE *p;
struct student a;
p=fopen("ab.txt","w");
scanf("%d",&a.number);
scanf("%s",&a.name);
scanf("%d",&a.age);
scanf("%s",&a.sex);
scanf("%d",&a.birthday);
fwrite(&a,sizeof(struct student),1,p);
fclose(p);
}
void main()
{
add();
}
[此贴子已经被作者于2018-12-27 13:01编辑过]