WinRT(C++/CX) Platform::String^ 与 std::string 的类型转换 发表于 2018-08-23 | 分类于 CS Gist 仓库地址:https://gist.github.com/huihut/aa90bd3a202090e25b9a4792c80e6920 1234567891011121314#include <string>std::string Managed_Str_To_Std_Str(Platform::String^ ms){ std::wstring w_str(ms->Begin()); return std::string(w_str.begin(), w_str.end());}Platform::String^ Std_Str_To_Managed_Str(const std::string & input){ std::wstring w_str = std::wstring(input.begin(), input.end()); const wchar_t* w_chars = w_str.c_str(); return (ref new Platform::String(w_chars));} 本文作者: huihut 本文链接: https://blog.huihut.com/2018/08/23/TypeConversionBetweenPlatformStringAndStdstring/ 版权声明: 本博客所有文章除特别声明外,均采用 CC BY-NC-SA 4.0 许可协议。转载请注明出处!