lar_jens
asked on
Unicode to ASCII
Hi there..
I have an application that wants to use some old code once developed on unix, then ported to win32. I am developing my app on NT4.0.
The old code resides in a static library, and needs a char* as a parameter. My problem is that I am reading this parameter from the registry, and then passing it on to this old function. What I get back from the registry is a unicode string (wchar_t or CString if you like) and I need to convert this to a char* with characters of 8bits..
I know it's possible, but how??
I have an application that wants to use some old code once developed on unix, then ported to win32. I am developing my app on NT4.0.
The old code resides in a static library, and needs a char* as a parameter. My problem is that I am reading this parameter from the registry, and then passing it on to this old function. What I get back from the registry is a unicode string (wchar_t or CString if you like) and I need to convert this to a char* with characters of 8bits..
I know it's possible, but how??
ASKER
No this is not exactly what I want.. I need something that makes me 100% sure that the characters I send to my old function is 8 bits wide, nothing more, nothing less..
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
OK.. Wait a second.. I will try it out. I just thought that the multibyte character sets was wider than 8-bit..
ASKER
You were right. I'm sorry.. Here's your points.. You've earned them..
Glad to help, thanks
An API called
WideCharToMultiByte(...)
should help you out :)