首页
学习
活动
专区
圈层
工具
发布
社区首页 >问答首页 >从System::String^转换为System::String^

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

Stack Overflow用户
提问于 2019-01-10 08:48:19
回答 1查看 250关注 0票数 0

我有一个标准的库字符串,我想进行以下转换:

System::String^到std::string

EN

回答 1

Stack Overflow用户

回答已采纳

发布于 2019-01-10 08:59:20

std::string转换为System::String^的代码片段

代码语言:javascript
复制
#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的代码片段

代码语言:javascript
复制
#include <msclr/marshal.h>

System::String^ str = "Hello World";
std::string result = msclr::interop::marshal_as<std::string>(str);
票数 2
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/54120549

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档