1. CString 转 string
unicode: // 转化为unicode.
CString sz1 = L"abc";
std::string sz2 = CT2A(sz1.GetBuffer());
非unicode: // 转化为非unicode.
CString sz1 = "abc";
std::string sz2 = sz1.GetBuffer();
MFC 转码
最新推荐文章于 2025-07-18 14:00:51 发布
本文介绍了如何在C++中将CString类型转换为string类型的方法。包括两种情况:转化为unicode及非unicode的方式。对于unicode,使用CT2A函数进行转换;而非unicode情况下,则直接通过GetBuffer方法实现。

48

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



