Char 转 CString

来源:互联网 发布:sql r2是什么 编辑:程序博客网 时间:2024/06/06 06:02
CString CharToCString(char *pcText){/* Get the number of wide character array */DWORD dwLength = MultiByteToWideChar(CP_ACP, 0, pcText, -1, NULL, 0);/* Allocate wide character array */wchar_t *pwText;pwText = new wchar_t[dwLength];if (!pwText){delete []pwText;}/* Convert to ASCII */MultiByteToWideChar(CP_ACP, 0, pcText, -1, pwText, dwLength);/* Convert to CString */CString csText(pwText);/* Release memory */delete []pwText;return csText;}

原创粉丝点击