Link to home
Start Free TrialLog in
Avatar of lar_jens
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??
Avatar of ScottyDawg
ScottyDawg

This sort of thing is also a problem when calling something like ExecuteSQL which expects and ASCII string and will fail if it gets something in UNICODE.

An API called

WideCharToMultiByte(...)

should help you out :)
Avatar of lar_jens

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
Avatar of ScottyDawg
ScottyDawg

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
OK.. Wait a second.. I will try it out. I just thought that the multibyte character sets was wider than 8-bit..
You were right. I'm sorry.. Here's your points.. You've earned them..
Glad to help, thanks