I have this function for my address book program but the first getline isn't working, somebody please tell me why!
PHP Code:
void ChangeEntry (sturec &book, fstream myfile, int &recordnum)
{
int whichnum;
char temp1[50], temp2[50];
cout << "\nRecord number to change? ";
cin >> whichnum;
if (whichnum > recordnum)
cout << "\nI'm sorry, there are not that many records. \nPlease select a record"<<
" between 0 and "<<recordnum<<endl<<endl;
else
{
myfile.seekg(whichnum*98);
myfile.read(temp1, 15);
cout <<"Last name: "<<temp1;
cout <<"\nLast name? \n";
cin.getline (temp2, 15);
cout << temp2;
if (strcmp(temp2, "")!=0)
strcpy (book.lastname, temp2);
myfile.read(temp1, 15);
cout <<"First name: "<<temp1<<endl;
cout <<"First name? ";
cin.getline (temp2, 15);
if (strcmp(temp2, "")!=0)
strcpy (book.firstname, temp2);
}
}