Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

C++: converting WCHAR to LPCWSTR - real working example

Tags:

c++

winapi

I have a situation where I need to convert this:

WCHAR path[260];

to:

LPCWSTR pathAfterConversion;

How can I do that?

like image 980
Ernestas Gruodis Avatar asked Mar 29 '14 15:03

Ernestas Gruodis


2 Answers

LPCWSTR pathAfterConversion = path;

should work fine.

Note that WCHAR is actually wchar_t and LPCWSTR is actually wchar_t const*. Both are typedefs.

like image 73
Nawaz Avatar answered Sep 18 '22 22:09

Nawaz


pathAfterConversion = path;

No conversion necessary.

like image 41
Mark Ransom Avatar answered Sep 21 '22 22:09

Mark Ransom