prompting the user for a file to save data in
<p>what i want to do is to prompt the user for a file to save the data in what i have tried is :</p>

<pre><code>  string save;
  cout&lt;&lt;"Enter filename to save (ex: file.txt): ";
  cin&gt;&gt;save;
  ofstream myfile;
  myfile.open(save);
  myfile &lt;&lt;"ID \tName \tSales\n";
</code></pre>

<p>however i get an error: no matching function for call to ‘std::basic_ofstream >::open(std::string&amp;)’</p>

<p>EDIT:</p>

<p>So i have updated my code but this doesn't allow me to enter the name of the file. why is that</p>

<pre><code>  char file_name[81];
  cout&lt;&lt;"Enter filename to save (ex: file.txt): ";
fflush(stdin);
  cin.getline(file_name, 81);
</code></pre>
