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