Hi, I'm trying to create a CD database and I want to have a .txt file that contains the database. So as I start the program, it will read in the database and anything I add or erase from it then it will update the file.
So i have this so far:
Code:ofstream file("databaseFile.txt", ios::out | ios::app); if ( !file.is_open() ) { cout << "Error opening File!" << endl; exit(1); }
And i think that should open the file and say that if I add anything to it then it will add it to the end instead of writing over the original file.
Now I'm confused about how to actually get stuff on that file. The way the program is set up is the main function consists of a menu where you can add, delete, or print the CD's. So if I want to add a cd then it prompts me for the Artist, Title, and Year and then calls the addCD function in which it will add it to an empty spot in the database. How do I get it to add it to an output file?
Someone please help