A couple ways to solve your problem:
1. after opening the file call seekp(ios::end); set the file pointer to end-of-file before writing
2. Add the ios::ate flag to the open statement: fout.open("library.txt", ios::out | ios::ate);
Sponsor
Team Colleague
Featured Poster
Reputation Points: 5608
Solved Threads: 2283
Retired and Enjoying Life
Offline 21,961 posts
since Aug 2005