Unicode -> ANSI, ANSI -> Unicode
Is there a function (Win32 or STL or CRT) to convert a string from ANSI to Unicode and vice versa? I''ve searched through MSDN, and stupidly I didn''t find anything that talk about it. Can someone please tell me the function?
My compiler generates one error message: "Doesn''t compile."
-Albert Tedja-
Sure - and here''s a couple of functions too
WideCharToMultiByte :: Unicode -> Ansi
MultiByteToWideChar :: Ansi -> Unicode
WideCharToMultiByte :: Unicode -> Ansi
MultiByteToWideChar :: Ansi -> Unicode
// ----------------------------------------------------------------------------////BOOL UnicodeToAnsi( LPWSTR pszwUniString, LPSTR pszAnsiBuff, DWORD dwAnsiBuffSize ){ int iRet = 0; iRet = WideCharToMultiByte( CP_ACP, 0, pszwUniString, -1, pszAnsiBuff, dwAnsiBuffSize, NULL, NULL ); return ( 0 != iRet );}// ----------------------------------------------------------------------------////BOOL AnsiToUnicode( LPSTR pszAnsiString, LPWSTR pszwUniBuff, DWORD dwUniBuffSize ){ int iRet = 0; iRet = MultiByteToWideChar( CP_ACP, 0, pszAnsiString, -1, pszwUniBuff, dwUniBuffSize ); return ( 0 != iRet );}
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement