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;
}
Char 转 CString
最新推荐文章于 2021-05-20 05:58:56 发布