清泛IT社区
标题:
MFC CString与std::string互转
[打印本页]
作者:
zqp2013
时间:
2014-12-27 10:50
标题:
MFC CString与std::string互转
CString cstr;
std::string stdstr;
非Unicode:
stdstr.assign( (
LPSTR
) (LPCTSTR) cstr); 或者 stdstr = std::string( (
LPSTR
) (LPCTSTR) cstr);
cstr = CString( stdstr.data() );
Unicode:
stdstr.assign(
CT2A (
(LPCTSTR) cstr
)
); 或者 stdstr = std::string(
CT2A (
(LPCTSTR) cstr
)
);
cstr = CString( stdstr.data() );
欢迎光临 清泛IT社区 (https://bbs.tsingfun.com/)
Powered by Discuz! X3.3