为什么打开以后是乱码?
#include<Stdio.h>#include<stdlib.h>
struct student
{
int age;
int num;
char sex;
}student1;
save()
{
FILE *fp;
if((fp=fopen("D:\\334dd","wb"))==NULL)
{
printf("error");
return(0);
}
if(fwrite(&student1,sizeof(struct student),1,fp)!=1)
printf("file write error!");
fclose(fp);
}
void main()
{
printf("请输入数据!\n");
scanf("%d,%d,%s",&student1.age,&student1.num,&student1.sex);
printf("正在保存...\n");
save();
system("cls");
printf("保存成功!");
}