[C++] Open / Create a file without deleting the previous

Hi, as specified in the title, I want to open a file if it already exists and create it if it does not exist, but without deleting what was already within.

Because if I enter a string, then i exit the program, and i do the same again, i can only see the last string that i added, but not the first.

I open my file with:

ofstream archivo("eventos.txt");

How can i do what i want to do?.

Ps: Sorry if my english is not so good :(

Ps2: Sorry, i discovered how to do it after i made this post, if someone want to know its like this:

ofstream archivo("eventos.txt", ios::app);
Last edited on
Topic archived. No new replies allowed.