level 7
阮Tea
楼主
CString string("I'm a string");
//将CString 转为 wchar_t *
wchar_t* wCharString = string.GetBuffer(string.GetLength()+1);
size_t wCharSize = wcslen(wCharString) + 1;
//const size_t newsize = MAXLEN;
//将wchar_t * 转为 char []
size_t convertedChars = 0;
char temp[MAXLEN];
wcstombs_s(&convertedChars, temp, wCharSize, wCharString , _TRUNCATE);
//char [] 转成 unicode
DWORD dwNum = MultiByteToWideChar (CP_ACP, 0, temp, -1, NULL, 0);
wchar_t *pwText;
pwText = new wchar_t[dwNum];
MultiByteToWideChar (CP_ACP, 0, temp, -1, pwText, dwNum);// 开始转换
2009年10月01日 17点10分
1
//将CString 转为 wchar_t *
wchar_t* wCharString = string.GetBuffer(string.GetLength()+1);
size_t wCharSize = wcslen(wCharString) + 1;
//const size_t newsize = MAXLEN;
//将wchar_t * 转为 char []
size_t convertedChars = 0;
char temp[MAXLEN];
wcstombs_s(&convertedChars, temp, wCharSize, wCharString , _TRUNCATE);
//char [] 转成 unicode
DWORD dwNum = MultiByteToWideChar (CP_ACP, 0, temp, -1, NULL, 0);
wchar_t *pwText;
pwText = new wchar_t[dwNum];
MultiByteToWideChar (CP_ACP, 0, temp, -1, pwText, dwNum);// 开始转换