Differences of ios::out , ios::trunc

I would like to ask, what's the difference of ios::out , ios::trunc

1
2
ofstream out("/bla/bla/a1.txt", ios::out);
ofstream out("/bla/bla/a1.txt", ios::trunc);


The commands above (not together in the same program...), did the same thing in a1.txt....
It was full of text, and then the text gone away !!!

So what's the difference ??
THANKS IN ADVANCE !!!
ios::out is the default flag for ofstream objects. This simply means that it's going to be OUTputting to the file. ios::trunc will erase the data in the file. I believe the flag you want is ios::app which stands for APPend.

Here is a list of options: http://www.cplusplus.com/reference/iostream/fstream/fstream/

Check under the parameters section.
My friend thank you very much for your answer...
But the question remains...

The ios::out, don't only make output, but if the file exists, it erases its contents... (try it ....)
The same thing does the ios::trunc, as all of us know !!!

The ios::app I know what it does...

Any ideas my friend ?? I am depending on this site, because I believe that YOU are the people who know the C++ best !!
THANKS IN ADVANCE !!! (again)
Topic archived. No new replies allowed.