繁体   English   中英

从System :: String ^转换为System :: String

[英]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.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM