1.string-->char *,
调用string的方法c_str()或者data();
string str = "abc"; char *pChar = (char *)str.data();
2.char *-->string
char *pTemp = "abcdef"; string tmpStr(pTemp);
3.string-->char[]
string str = "abcdefg"; char p[10]; int i = 0; for (i = 0; i < str.length(); i++) { p[i] = str[i]; } p[i] = ' ';
4.char[]-->string
char p[10] = "abcdefg"; string str1 = p;