Quote Originally Posted by Amleto View Post
1) Because you told it to.

2) How is the compiler meant to know when you want to free the memory?

If you dont want to lose all data in file, use ios::app, I believe.
Thanks for the reply.

Because its the end of the program. How the compiler know to delete the memory for other variables for example?