void Phonebook::search_name()
{
int token;
string field,line;
char line1[50],line2[50];
cout<<"Enter the first name of the person you wanna search ?? \n";
cin.ignore();
getline(cin,field);
cout<<"person to be searched is "<<field;
cin.get();
token=0;
ifstream readfil;
readfil.open("data.txt");
if(!readfil)
{
cout<<"file does not exist";
}
while(readfil.good())
{
readfil.getline(line1,12,'~');
if(line1==field)
{
token=1;
readfil.seekg(0,ios::beg);
readfil.getline(line2,50,'|');
cout<<"the person to be found is "<<line2;
break;
}
if(token==0)
cout<<"\n\n.....data not found...";
}
}