我已经写了一些东西到文件中,现在我想在屏幕上阅读和查看内容。我编写了要查看的函数,但它没有显示任何内容。这是视图函数的代码。我正在测试只查看2个变量。底部调用的显示函数来自父类,它显示其他类的所有变量
void ViewAll(string name, Intervention inte)
{
ifstream clientfile(name, ios::in);
if (clientfile)
{
int hour, min, day, month, yr, snum, age;
string fname, lname, interNo, problem, clinic, area, ex, li, type, breed, gender, sname, town, pay;
while (clientfile && !clientfile.eof())
{ //needed to loop through each record in the file
clientfile >> interNo;
clientfile >> clinic;
clientfile >> lname;
clientfile >> fname;
clientfile >> pay;
clientfile >> snum;
clientfile >> sname;
clientfile>> town;
clientfile >> area;
clientfile >> ex;
clientfile >> li;
clientfile >> type;
clientfile >> breed;
clientfile >> gender;
clientfile >> problem;
clientfile >> age;
clientfile >> day;
clientfile >> month;
clientfile >> yr;
clientfile >> hour;
clientfile >> min;
if (fname == inte.getClient().getFname())
{
break;
}
}
//after record is found, create record
inte.getClient();
inte.display();
system("pause");
}
//return inte;
}