string和char*
string转const char*
string s = "hello furong.";
const char *c = s.c_str();
string转char*
string -> const char* -> char*
string s = "hello furong.";
char *c = (char *)malloc(s.length());
memset(c, 0, s.length());
memcpy(c, s.c_str(), s.length());
char*转string
直接赋值
const char *c = "hello furong.";
string s = c;