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