CString转换到string:无法从“wchar_t *”转换为“std::basic_string<_Elem,_Traits,_Ax>”
对于你的应用来说
ANSI和UNICODE的区别就是
ANSI编码CString默认是窄字节的
UNICODE默认是宽字节的
std::string总是窄字节的
所以UNICODE下你要做宽窄字节转换
比如可以这样
USES_CONVERSION;
CString str;
std::string str1 = W2A(str.Getbuffer());
str.ReleaseBuffer();

本文详细解释了在C++中,CString与std::string之间的转换方法,特别是在Unicode环境下如何进行宽窄字节的转换,提供了具体的代码示例。

9946

被折叠的 条评论
为什么被折叠?



