cpp convert char pointer to str code example Example: char * to string c++ const char *s = "Hello, World!"; std::string str(s);