我在 C++ 中有一个函数,它有一个 std::string 类型的值,我想将它转换为 String^。
void(String ^outValue)
{
std::string str("Hello World");
outValue = str;
}
最佳答案
来自 MSDN:
#include <string>
#include <iostream>
using namespace System;
using namespace std;
int main() {
string str = "test";
String^ newSystemString = gcnew String(str.c_str());
}
关于string - 从 std::string 转换为 String^,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/45667988/