wchar_t* chaToWchar(const char* ch)
{
wchar_t *wchar;
int len = MultiByteToWideChar(CP_ACP, 0, ch, strlen(ch), NULL, 0);
wchar = new wchar_t[len + 1];
MultiByteToWideChar(CP_ACP, 0, ch, strlen(ch), wchar, len);
wchar[len] = '\0';
return wchar;
}
char* wcharToChar(const wcahr_t* wch)
{
char * char;
int len = WideCharToMultiByte(CP_ACP, 0, wch, wcslen(wch), NULL, 0, NULL, NULL);
char = new char[len + 1];
WideCharToMultiByte(CP_ACP, 0, wch, wcslen(wch), char, len, NULL, NULL);
char[len] = '\0';
return char;
}
c++wchar_t和char之间的相互转换
于 2021-04-26 15:37:31 首次发布
关键词由CSDN通过智能技术生成