rendered paste bodyvoid CPhoneBook::display()
{
file.seekp(0);
file.seekg(0);
cout<<file.tellg()<<" "<<file.tellp()<<endl;
char record[40], x, ch;
int count = 1, counter=0, len=0;
file.seekp(8, ios::beg);
cout<<file.tellg()<<" "<<file.tellp()<<endl;
cout<<"\n";
cout<<"Records in the file are: "<<endl;
drawLine (30);
//if (file.bad())
// cout<<"Error"<<endl;
//if (file.fail())
// cout<<"Failed"<<endl;
//if (file.is_open())
// cout<<"Opened"<<endl;
while (!file.fail())
{
cout<<file.tellg ();
file >> x;
if ( x != '*')
{
file.seekp (sizeof(int), ios::cur);
file.getline (record, 40, '_');
cout<<count<<" "<<record<<endl;
len = strlen (record);
file.seekp(39-(len+5), ios::cur);
}
else
file.seekp(39, ios::cur);
count++;
}
//return;
}