How do you convert string to c_str() in this situation?
<blockquote>
  <p><strong>Possible Duplicate:</strong><br>
  <a href="http://stackoverflow.com/questions/347949/convert-stdstring-to-const-char-or-char">Convert std::string to const char* or char*</a>  </p>
</blockquote>



<p>My code is this </p>

<pre><code>#include &lt;iostream&gt;
#include &lt;fstream&gt;

using namespace std;

string mapChange(int side, string oldMap);

int main(){

  string createMapName;
  string createMapNameData [10];
  int featureSelect;

  cout &lt;&lt; "(1)Game or (2)Mapmaker";
  cin &gt;&gt; featureSelect;

  if(featureSelect == 2)
  {
    cout &lt;&lt; "Name of Map?";
    cin &gt;&gt; createMapName;
    ofstream mapName;
    mapName.open (createMapName);
    mapName &lt;&lt; createMapNameData[0] &lt;&lt; endl;
  }
  return 0;
}

string mapChange(int side, string oldMap){

    string newMap;
    if(oldMap == "Test")
    {
      cout &lt;&lt; "Map Found :D";
    }
    else
    {
      cout &lt;&lt; "ERROR MAP NOT FOUND, PLEASE REINSTALL.";
    }
    return newMap;
}
</code></pre>

<p>How do I use a c_str instread of string on line 15 i.e. how do I convert string to c_str()?
Please help,
Lijrobert</p>
