title: Creating output file in C++ Visual Studio 2010
body: <p>I have a C++ project which I initially compiled with g++. Now, I am trying to make it work in Visual Studio 2010 and the problem is that the regular commands that create an empty output file for writing:</p>
  
  <pre><code>#include &lt;fstream&gt;
  using namespace std;
  
  ofstream fout("afile.txt");
  fout&lt;&lt;"write someting"&lt;&lt;endl;
  fout.close();
  </code></pre>
  
  <p>will not work in VS2010 (no file is created). Even if the file already exists nothing is written on it.</p>
  
  <p>So, any ideas what is the correct way of opening a file for writing from C++ in VS2010 ?</p>