title: Create a text file and write to it in C++?
body: <p>I am using Visual C++ 2008. I want to create a text file and write to it.</p>
  
  <pre><code>char filename[]="C:/k.txt";
  FileStream *fs = new FileStream(filename, FileMode::Create, FileAccess::Write);
  fstream *fs =new fstream(filename,ios::out|ios::binary);
  fs-&gt;write("ghgh", 4);
  fs-&gt;close();
  </code></pre>
  
  <p>Here is showing error of FileStream </p>