c_str() 函数
Syntax:
#include <string>
#include <string>
const char* c_str();
The function c_str() returns a const pointer to a regular C string, identical to the current string. The returned string is null-terminated.
Note that since the returned pointer is of type const, the character data that c_str() returns cannot be modified. Furthermore, you do not need to call free() or delete on this pointer.
c_str函数的返回值是const char*的,不能直接赋值給char*。
c_str()返回一个客户程序可读不可改的指向字符数组的指针,不需要手动释放或删除这个指针。