title: Unwanted Carriage Returns in ofstream
body: <p>The following C++ code:</p>
  
  <pre><code>ofstream out("File.txt");
  const char *str = "0\r\n1\r\n2\r\n";
  out &lt;&lt; str;
  </code></pre>
  
  <p>Creates following file (File.txt above):</p>
  
  <p><img src="https://i.stack.imgur.com/vgdq5.png" alt="File.txt content"></p>
  
  <p>Why is there extra CR's and LF's? My platform is Windows 7 and compiler VS 2013.</p>
  
  <p>The situation above will cause problem with another of my program that will parse this file line by line and that program assumes that every line will contain data. I could remove empty lines but I want to understand why when <code>str</code> is saved, there are extra CR's and LF's.</p>