title: Previous lines are cleared on ofstream
body: <p>I would like to write a new line with a string on a file when the writeToFile function is called. Is that possible without clearing the previous line or the whole txt?</p>
  
  <pre><code>void writeToFile(string str) {
      ofstream fileToWrite;
      fileToWrite.open("C:/Users/Lucas/Documents/apps/resultado.txt");
      if(fileToWrite.good()) {
          //write the new line without clearing the txt
                  //fileToWrite &lt;&lt; str won't work for this reason
      }
      fileToWrite.close();
  }
  </code></pre>