title: C++ ofstream line break
body: <p>This is my code:</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;fstream&gt;
  using namespace std;
  int main()
  {
      ifstream ifile ("input.dat", ios::in);
      ofstream ofile ("output.dat",ios::out);
  
      int num;
      ifile &gt;&gt; num;
      ofile &lt;&lt; num;
      ofile &lt;&lt; endl;
      ofile &lt;&lt; "Did we go to new line?";
      ofile &lt;&lt; endl;
  
      return 0;
  }
  </code></pre>
  
  <p>The problem is, everything in output.dat is on the same line. How can I resolve this?</p>
  
  <p>Thanks!</p>
  
  <p>EDIT: I was using Windows to see the files and Linux to compile. This is why I was running into this issue. Using <code>cat output.dat</code> on the Linux side to see the file contents would have revealed that Windows vs. Linux line breaks are different at the time.</p>