ok, heres the problem, whenever i run this function it displays the proper results from the file, but the prints out a empty set of record fieldsi know its running through the while loop one extra time, but i dont know how to stop it! anyone have any suggestions??
Tagged by SalemCode:void Displayallcustomers() { string LASTNAME, FIRSTNAME, STREETADDRESS, CITY, PROV, POSTALCODE; ifstream infile; infile.open("customers.dat", ios::in); if (infile.is_open()) { while (!infile.eof()) { getline(infile, LASTNAME, '#'); getline(infile, FIRSTNAME, '#'); getline(infile, STREETADDRESS, '#'); getline(infile, CITY, '#'); getline(infile, PROV, '#'); getline(infile, POSTALCODE, '#'); cout <<"Last Name:" << LASTNAME << "" <<endl; cout <<"First Name:" << FIRSTNAME << "" <<endl; cout <<"Street Address:" << STREETADDRESS << ""<<endl; cout <<"City:" << CITY << "" <<endl; cout <<"Province:" << PROV << "" <<endl; cout <<"Postal Code:" << POSTALCODE << ""<<endl; } infile.close(); } else cout<<"YOU HAVE SELECTED AN INVALID OPTION"<<endl; }



LinkBack URL
About LinkBacks
i know its running through the while loop one extra time, but i dont know how to stop it! anyone have any suggestions??


