To convert a string into char*, you can use this method
string str = "hello, pandora";
char * cstr = new char[str.size() + 1];
Note that c_str() only treat the string as a char* without moving its pointer. You need to copy the result into a new pointer to have a brand new char*.
For a full reference, you can check here.