一、string 转为 const char *
string st = "hello,world";
const char * cs = st.c_str();
二、string 转为 char *
string st = "hello,world";
char * p;
int len = st.length();
p = new char[len+1];
strcpy(p,st.c_str());
三、const char * 转为 string
const char * p = "hello,world";
string st(p);
四、char * 转为 string
char * p = "hello,world";
string st(p);