title: C++ Writing a file inside a loop
body: <p>This should be counting 30 seconds down into a txt file. But it hardly ever makes the txt itself either. What am I doing wrong? Or is it that in loop c++ is just not capable of file handling.
  There is just nothing in the text file</p>
  
  <pre><code>for (i = 30; i &gt;= 0; i--)
      {
          ofstream file;
          file.open("asd.txt");
          file &lt;&lt; i;
          file.close();
          Sleep(1000);
      }
  </code></pre>