方法一:
char temp[6];
CString str="hello";
sscanf(str,"%s",temp);
CString str="hello";
sscanf(str,"%s",temp);
方法二:
char sHostIP[20];string strHostIP;
memcpy(sHostIP,strHostIP.c_str(),20);
memcpy(sHostIP,strHostIP.c_str(),20);
转载于:https://blog.51cto.com/llydmissile/1280341