A: c_str() 是为了兼容C字符串常量 把C++中的string类型转换成C中的字符串类型
String str=“Hello World”;
const char * ch = str.c_str();
string a("hello world");
const char *cap=NULL; //const 作用:
char *b=NULL;
cap=a.c_str(); /*用法<1>*/
b=new char[a.size()+1];
strcpy(b,a.c_str()); /*用法<2>*/