Convert TCHAR to LPWSTR in VC ++?

How to convert TCHAR to LPWSTR in VC ++?

Example: I have

TCHAR  achValue[16383]; 

I want to assign this value to LPWSTR. How to achieve this in VC ++

Any help is appreciated.

+3
source share
3 answers

TCHAR- either char, or wchar_t based on your Unicode / MBCS settings. If you compile as unicode, it achValuecan be used as LPWSTR. If not, you need to use MultiByteToWideCharto convert characters to achValuefrom the encoding used for UTF-16.

+4
source

If your project file has a flag UNICODE, then you can simply doLPWSTR p = achValue;

0
source

#ifdef 'd : if UNICODE ( TCHAR wchar_t), , ( MultiByteToWideChar ).

0

Source: https://habr.com/ru/post/1795206/


All Articles