[英]How can I convert CString to WCHAR* and std::string to WCHAR* in C++, not wchar_t*
我想在 Visual Studio C++ MFC 应用程序中将CString
转换为WCHAR*
或将std::string
转换为WCHAR*
。 我在 stackoverflow 中发现它只有转换为wchar_t*
的解决方案。
请帮我。 谢谢!
当您使用 CString 时,您可以访问 CW2A ATL 宏,它将 CString 转换为字符串。
CString theCStr;
std::string STDStr( CW2A( theCStr.GetString(), CP_UTF8 ) );
或者参考这个文件。
我相信CString
class 可以做这样的转换:
CStringA a = "ANSI";
CStringW w(a);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.