char[]转char*
char charArray[]="Hello World";
char* charList=charArray;
char[]转string
char charList[]="Hello World";
string str=charList;
char*转string
char* charList="Hello World";
string str=charList;
string转char[]
string str="Hello World";
char charArray[str.length()+1];
strcpy(charArray, str.c_str());
string转char*
string str="Hello World";
char* charList=const_cast<char *>(str.c_str());
注意
使用 char[] 时一定要注意长度+1,因为他有一个 '\0' 字符,但不显示表达出来