I am trying to make a simple phone book. I've got everything all right right down to the actual output to the file.
I used ios::ate to open the file and go to the end of the file, but when I try to add a second entry, it overwrites the first.Code:cout << "Is this information correct? (Y or N)"; ch = getch(); if(ch == 'y' || ch == 'Y'){ ofstream file; file.open("Book.txt", ios::ate); file << data.fname << " " <<data.lname << endl << data.phnum << endl << data.addy << endl << data.cmt << endl << endl; file.close(); menu(); }
Any help at all would be appreciated.
Thanks