为什么会这样?
struct Account
{
char cardNum[16];
char userName[30];
char balance[50];
};
char ch;
FILE* fp;
if ((fp=fopen("D:\\华软2021-2022\\c2\\ATM模拟机\\accounts.txt", "r")) == NULL) {
printf("文件打开错误");
exit(0);
}
struct Account user;
fread(&user,sizeof(user),1, fp);
fclose(fp);
puts(user.userName);