unicode编码宽字节与单字节之间的转换

多字节转换为宽字节

  LPWSTR show_char(LPBYTE pbyte, DWORD len)
{
LPWSTR lpw;
int wlen;
wlen = MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pbyte, len + 1, NULL, 0);
lpw = new WCHAR[wlen];
MultiByteToWideChar(CP_ACP, 0, (LPCSTR)pbyte, len + 1, lpw, wlen);
//MessageBox(NULL, lpw, NULL, MB_OK);
// delete []lpw;
return lpw;
}

宽字节转换为多字节

total = atoi((char *)temp);

memset(temp, 0, sizeof(temp));
WideCharToMultiByte(CP_ACP, 0, m_total, -1, (LPSTR)temp, sizeof(temp), NULL, NULL);

你可能感兴趣的:(null,delete)