// ANSI(char) to Unicode(TCHAR)
char* temp = "測試";
int nIndex = MultiByteToWideChar(CP_ACP, 0, temp , -1, NULL, 0);
TCHAR *pUnicode = new TCHAR[nIndex + 1];
MultiByteToWideChar(CP_ACP, 0, temp , -1, pUnicode, nIndex);
// Unicode(WCHAR) to ANSI(char)
TCHAR *pUnicode = _T("你好");
int nIndex = WideCharToMultiByte(CP_ACP, 0, pUnicode, -1, NULL, 0, NULL, NULL);
char *temp = new char[nIndex + 1];
WideCharToMultiByte(CP_ACP, 0, pUnicode, -1, temp , nIndex, NULL, NULL);
delete pAnsi;
沒有留言:
張貼留言