Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How do you convert LPCWSTR to const char *?

How do you convert LPCWSTR to const char *?

Thanks

like image 361
flavour404 Avatar asked Dec 27 '10 23:12

flavour404


2 Answers

Use the WideCharToMultiByte function.

Note that LPCWSTR is the same as const wchar_t *, so if you're dealing with wide character data throughout your application, you may not need to convert it at all.

like image 87
Greg Hewgill Avatar answered Oct 12 '22 23:10

Greg Hewgill


You can also have a look at wcstombs_s

like image 44
Red5 Avatar answered Oct 12 '22 23:10

Red5