如题
static int CString2Char(CString str, char *ch)
{
// TODO: 此函数就是字符转换函数的实现代码
int len = WideCharToMultiByte(CP_ACP, 0, str, -1, NULL, 0, NULL, NULL);
if (len > 0)
WideCharToMultiByte(CP_ACP, 0, str, -1, ch, len, NULL, NULL);
ch[len] = '\0'; // 注意以'\0'结束
return len;
}
不用申请空间