if (szUnicodeString && szMultiByteString) { // If no code page specified, take default for system if (nCodePage == -1) { nCodePage = GetACP(); }
try { nReturn = MultiByteToWideChar(nCodePage,MB_PRECOMPOSED,szMultiByteString,-1,szUnicodeString,nUnicodeBufferSize);
if (nReturn == 0) { bOK = false; } } catch(...) { bOK = false; } } else { bOK = false; }
ASSERT(bOK); return bOK; }
// -------------------------------------------------------------------------------------------- // // CStdioFileEx::GetMultiByteStringFromUnicodeString() // // -------------------------------------------------------------------------------------------- // Returns: BOOL // Parameters: wchar_t * szUnicodeString (IN) Unicode input string // char* szMultiByteString (OUT) Multibyte output string // short nMultiByteBufferSize (IN) Multibyte buffer size // UINT nCodePage (IN) Code page used to perform conversion // Default = -1 (Get local code page). // // Purpose: Gets a MultiByte string from a Unicode string // Notes: None. // Exceptions: None. // BOOL CStdioFileEx::GetMultiByteStringFromUnicodeString(wchar_t * szUnicodeString, char* szMultiByteString, short nMultiByteBufferSize, UINT nCodePage) { BOOL bUsedDefChar = FALSE; BOOL bGotIt = FALSE;
if (szUnicodeString && szMultiByteString) { // If no code page specified, take default for system if (nCodePage == -1) { nCodePage = GetACP();
上一篇:Flash V2组件初探
下一篇:通过middlebox实施P2P通讯三[传]
|