Codeproject 下的一篇文章,未试验。先备着日后看看是否有用。
As you use CString, you have access to the CW2A ATL macro, assuming that you work with _UNICODE defined, here it is:
CString theCStr; ... std::string STDStr( CW2A( theCStr.GetString() ) );which will convert to "system encoding on the user's machine" (thanks Nemanja [ ^ ] comment !), if you want to specify the code page, UTF-8 encoded for example as the original, here it is:
CString theCStr; ... std::string STDStr( CW2A( theCStr.GetString(), CP_UTF8 ) );
本文介绍了如何在使用CW2AATL宏将CString转换为std::string,并提供了指定编码的示例。适用于Unicode定义的工作环境。
4809

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



