0

Possible Duplicate:
How do you convert LPCWSTR to const char *?

I have a function that gets a LPCWSTR string for win32 api usage. Now I have a function that sends data in ASCII to the IRC server. So now I need to convert it to ASCII, I haven't found any solutions, I only found ways to convert ASCII to UNICODE.

Community
  • 1
  • 1
TryTech
  • 41
  • 2
  • 3

1 Answers1

2

WideCharToMultiByte converts from UNICODE to MBCS. If your original wide char string consisted only of characters which could be represented in ASCII, then this will result in a ASCII string. You can also use wcstombs which internally calls WideCharToMultiByte.

Either way, you will get a LPSTR or char * (which are the same).

user93353
  • 13,733
  • 8
  • 60
  • 122