Unicode -> ANSI, ANSI -> Unicode

Started by
0 comments, last by nicho_tedja 21 years, 9 months ago
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-
My compiler generates one error message: "does not compile."
Advertisement
Sure - and here''s a couple of functions too

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 );}  
"I thought what I'd do was, I'd pretend I was one of those deaf-mutes." - the Laughing Man

This topic is closed to new replies.

Advertisement