I have an add filename function that saves the filenames to a text file like so:
and retrieves the filenames from another function to manipulate them withCode:
outfile << filename << endl;
This crashes at the last infile.open("database.txt") call because of where the cursor is positioned in the saved text file and I guess it tries to read the last line which doesn't have any text in it
If I manually save the file with the cursor position with the last end of line command removed, it works perfectlyCode:
TEXT FILE THIS WORKS
The problem is, once it's saved like that, when I return to my add file function I obviously have a little problem
filenameFILENAME //should not be here
Basically, I just don't know how I can save my file in order to be able to retrieve it correctly.
Do I need to put " endl" at the end of each filename I save on the output?
If I don't, it is not only on one line so how do I retrieve only one filename at a time?
Any suggestions? Thanks in advance!!!