string in fstream?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/6323619/c-ifstream-error-using-string-as-opening-file-path">C++ ifstream error using string as opening file path.</a>  </p>
</blockquote>



<p>ok, this is my fstream code <code>mapName.open (createMapName);</code></p>

<p>createMapName was initialized like this <code>string createMapName;</code></p>

<p>why does this fstream come up with errors like </p>

<pre><code>g++ -Wall -o "untitled" "untitled.cpp" (in directory: /home/lijrobert/Documents/Project)
untitled.cpp: In function ‘int main()’:
untitled.cpp:15:28: error: no matching function for call to ‘std::basic_ofstream&lt;char&gt;::open(std::string&amp;)’
untitled.cpp:15:28: note: candidate is:
/usr/include/c++/4.6/fstream:702:7: note: void std::basic_ofstream&lt;_CharT, _Traits&gt;::open(const char*, std::ios_base::openmode) [with _CharT = char, _Traits = std::char_traits&lt;char&gt;, std::ios_base::openmode = std::_Ios_Openmode]
/usr/include/c++/4.6/fstream:702:7:
note:   no known conversion for argument 1 from ‘std::string {aka std::basic_string&lt;char&gt;}’ to ‘const char*’
Compilation failed.
</code></pre>
