[英]Convert from System::String^ to System::String
我有一个标准的库字符串,我想进行以下转换:
系统:: String ^到std :: string
将std::string
转换为System::String^
代码片段:
#include <msclr/marshal.h>
std::string str = "Hello World";
System::String^ result = msclr::interop::marshal_as<System::String^>(str.c_str());
将System::String^
转换为std::string
代码片段:
#include <msclr/marshal.h>
System::String^ str = "Hello World";
std::string result = msclr::interop::marshal_as<std::string>(str);
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.