CString cs=_T("测试字符串");
int n = cs.GetLength(); //获取str的字符数
int len = WideCharToMultiByte(CP_ACP, 0, cs, n, NULL, 0, NULL, NULL);
char charbuf[256]; //以字节为单位
WideCharToMultiByte(CP_ACP, 0, cs, n, charbuf, len, NULL, NULL);
charbuf[len + 1] = '\0';