C++ lpcwstr 到 wstring

标签 c++ wstring lpcwstr

我想在 C++ (VS 2010) 中将 LPCWSTR 转换为 wstring。 我想在 OutputDebugStringW() 中使用它。

谢谢。

最佳答案

我们只需将 LPCWSTR 传递给 wstring 的构造函数,如下所示:

LPCWSTR str=L"fun";
wstring str2(str);

关于C++ lpcwstr 到 wstring,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/15743838/

相关文章:

c++ - C++文件加载期间的UTF8加扰

c++ - Visual Studio 2010 Arduino cpp 错误 : argument of type "char *" is incompatible with parameter of type "LPCWSTR"

c++将字符串转换为参数中的LPCWSTR

c++ - 在 std::bitset::operator[] 中创建的 std::bitset::reference 对象的生命周期?

c++ - 表达式是在C++中调用函数的结果

c++ - 将 TCHAR 添加到 wstring : doesn't work

c++ - MessageBox 上的 Visual Studio 2015 WinAPI 错误

c++ - PlatformIO (Atom) 的 src 文件夹中是否可以有两个文件?

c++ - 类 sf::RenderWindow' 没有名为 'clear' 的成员

c++ - 从原始内存位置 memcpy 到 vector<wchar_t>