std::string str = "Hello World!"; const char * cstr = str.c_str(); // Returns pointer to "Hello World!" char buffer[6]; strcpy(buffer, str.c_str()); // Copies "Hello" into bufferIn the first example, the c_str() function is used to get the pointer to the null-terminated character array of the string. In the second example, strcpy function is used to copy the first 5 characters of the string into a character array. The cstr function is from the standard C++ library.