1

I would like to convert a LPCWSTR to wstring in C++ (VS 2010). I want to use this in OutputDebugStringW().

Thank you.

tmighty
  • 10,734
  • 21
  • 104
  • 218

1 Answers1

10

Well just pass the LPCWSTR to the constructor of wstring like this:

LPCWSTR str=L"fun";
wstring str2(str);
Johnny Mnemonic
  • 3,822
  • 5
  • 21
  • 33