title: C++ Ofstream a new line
body: <p>I am trying to do a new line in a ofstream, but it does not work. Everything is written on the same line in OUTPUT.txt</p>
  
  <pre><code>std::ofstream output;
  output.open("OUTPUT.TXT");
  output &lt;&lt; "sometext" &lt;&lt; "\r\n" &lt;&lt; "sometext" &lt;&lt; "\r\n" &lt;&lt; "sometext";
  output.close();
  </code></pre>
  
  <p>I also tried</p>
  
  <pre><code>output &lt;&lt; "sometext" &lt;&lt; std::endl &lt;&lt; "sometext" &lt;&lt; std::endl &lt;&lt; "sometext";
  </code></pre>
  
  <p>and</p>
  
  <pre><code>output &lt;&lt; "sometext" &lt;&lt; "\n" &lt;&lt; "sometext" &lt;&lt; "\n" &lt;&lt; "sometext";
  </code></pre>
  
  <p>and</p>
  
  <pre><code>output &lt;&lt; "sometext" &lt;&lt; '\n' &lt;&lt; "sometext" &lt;&lt; '\n' &lt;&lt; "sometext";
  </code></pre>
  
  <p>Everything was written on the same line, no new lines... Am I missing something?</p>