Char 轉成 TCHAR的辦法 // 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;
文章標籤
全站熱搜
創作者介紹
創作者 freestyler 的頭像
freestyler

Everything Will Flow

freestyler 發表在 痞客邦 留言(0) 人氣(469)