1. string转const char*
string str ="abc";
const char* charArr = str.c_str();
2. const char*转string
const char* charArr = "abc";
string str(charArr);
3. string转char*
string str ="abc";
char* charArr;
const int len = str.length();
charArr =new char[len+];
strcpy(charArr, str.c_str());
4. char*转string
char* charArr ="abc";
string str(c);
5. const char*转char*
const char* charArr1 ="abc";
char* charArr2 = new char[]; // 足够长
strcpy(charArr1, charArr2)