title: Writing into a text file without overwriting it
body: <p>I'm doing a numerical simulation of gravity in C++ and I want to back up my results every time a single step is counted.</p>
  
  <p>However, the way I do it now, the programm always overwrites the file. I guess I would be able to solve in by always saving the text in a different file or variable, but I wonder if there's an easier way to open a text file so that I wouldn't overwrite it.</p>
  
  <p>My current "back-up code" looks like this:</p>
  
  <pre><code>fstream log;
  log.open ("log.txt");
  if (log.is_open())
  {...
    ...
    log.close();
  }
  </code></pre>