Possible Duplicate:
Convert std::string to const char* or char*
My code is this
#include <iostream>
#include <fstream>
using namespace std;
string mapChange(int side, string oldMap);
int main(){
string createMapName;
string createMapNameData [10];
int featureSelect;
cout << "(1)Game or (2)Mapmaker";
cin >> featureSelect;
if(featureSelect == 2)
{
cout << "Name of Map?";
cin >> createMapName;
ofstream mapName;
mapName.open (createMapName);
mapName << createMapNameData[0] << endl;
}
return 0;
}
string mapChange(int side, string oldMap){
string newMap;
if(oldMap == "Test")
{
cout << "Map Found :D";
}
else
{
cout << "ERROR MAP NOT FOUND, PLEASE REINSTALL.";
}
return newMap;
}
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