It does not output data from the file, but only characters. Before that, everything worked, but now I can t figure out what the problem is.
C6031 回归价值:“scanf”
void func_list()
{
int row;
system("cls");
Title();
FILE* ek;
ek = fopen("Record2.dat", "r");
cout << "
!!!!!!!!!!!!!! List Patients Record !!!!!!!!!!!!!
";
gotoxy(1, 15);
cout << "Имя";
gotoxy(20, 15);
cout << "Пол";
gotoxy(32, 15);
cout << "Возрост";
gotoxy(37, 15);
cout << "Адрес";
gotoxy(49, 15);
cout << "Контакты";
gotoxy(64, 15);
cout << "Почта";
gotoxy(88, 15);
cout << "Диагноз";
gotoxy(98, 15);
cout << "Принимающий доктор
";
cout << "=================================================================================================================";
row = 17;
while (fscanf(ek, "%s %s %c %i %s %s %s %s %s
", p.First_Name, p.Last_Name,
&p.Gender, &p.age, p.Address, p.Contact_no, p.Email, p.Problem, p.Doctor) != EOF)
{
gotoxy(1, row);
cout << "%s %s", p.First_Name, p.Last_Name;
gotoxy(20, row);
cout << "%c", p.Gender;
gotoxy(32, row);
cout << "%i", p.age;
gotoxy(37, row);
cout << "%s", p.Address;
gotoxy(49, row);
cout << "%s", p.Contact_no;
gotoxy(64, row);
cout << "%s", p.Email;
gotoxy(88, row);
cout << "%s", p.Problem;
gotoxy(98, row);
cout << "%s", p.Doctor;
row++;
}
fclose(ek);
getch();
MainMenu();
}
看来所有东西都与《刑法》相符。 我无法理解为什么是产出,而不是档案中的必要数据。