CString 转化 成int类型:
CString str_port="12345";
int port = 0;
port = _ttoi(str_port); //转化成10进制;
CString转化成char[],函数:
void CStringToChar(CString str, char ch[])
{
char* tmpch;
int wLen = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
tmpch = new char[wLen + 1];
WideCharToMultiByte(CP_ACP, 0, str, -1, tmpch, wLen, NULL, NULL);
for (int i = 0; i < wLen; ++i)
ch[i] = tmpch[i];
}