convert ‘std::basic_string’ to ‘const char*’ in cpp code example Example: std string to const char * c++ std::string a = "string"; const char* b = a.c_str();