CString转char *

来源:互联网 发布:win10网络授权 编辑:程序博客网 时间:2024/06/05 11:36

基于Visual Studio 2010下Unicode编码的CString转char *


CString str = _T("CString to char*");DWORD dwNum = WideCharToMultiByte(CP_OEMCP,NULL,str,-1,NULL,NULL,0,NULL);char *cResult = (char *)malloc(dwNum);memset(cResult, 0, dwNum);WideCharToMultiByte(CP_OEMCP,NULL,str,-1,c,dwNum,0,NULL);TRACE("转换结果:%s\n",cResult);//转换结果:CString to char*


1 0
原创粉丝点击