title: Qt (C++): QFile creates text file successfully but does not write to it
body: <p>I have the following code, with which I am attempting to write to a file. When it is called, the file is created in the directory and the <code>for-loop</code> is entered. The values for in <code>QVector&lt;int&gt; program</code> also exist and are visible with <code>qDebug()</code>. However, after I close the file and the window, I check the file on my computer and it is completely empty. I have checked all over StackOverflow and the Qt forums and have yet to find a solution.</p>
  
  <pre><code>    QString save_file = "C:/Users/MARVIN/Documents/Saddleback College/2015/Fall/CS3A/Semester Project/Emulator/hello.txt";
  
      QFile file(save_file);
  
      if(file.open(QFile::WriteOnly))
      {
          QTextStream out(&amp;save_file);
  
          out &lt;&lt; "hello" &lt;&lt; endl;
  
          for(int i = 0; i &lt; 100; i++)
          {
              out &lt;&lt; program[i] &lt;&lt; endl;
              qDebug() &lt;&lt; program[i] &lt;&lt; endl;
          }
  
          file.close();
          this-&gt;close();
      }
  </code></pre>