簡體   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