I can't be sure, but it sounds like you have a function that takes a const char* as an input, and all you have is a std::string. If that's the case, you can forget about the const part for now - that's there to indicate to you and be made enforceable by the compiler that no changes will happen to that variable during the function. - This will actively prevent writing data to a var that's a reference.
But, getting back to the issue at hand, how to convert a std::string into something more useful.
How about just this plain and simple 1 liner?
char *writeable = str.c_str();
You can find the docs here:
http://www.cplusplus.com/reference/string/string/c_str/[
^]
Note specifically, you (a) don't have to allocate the memory yourself (b) you don't have to free it yourself (c) you shouldn't try to modify it - it's a const char*