添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
相关文章推荐
暴躁的石榴  ·  翻译 - Dolibarr ERP CRM ...·  4 月前    · 
不羁的饺子  ·  Debezium | Apache Flink·  4 月前    · 
玩篮球的火锅  ·  在Windows ...·  2 年前    · 
近视的口罩  ·  C# ...·  2 年前    · 
豁达的紫菜  ·  # vue 使用 threejs ...·  3 年前    · 
重情义的槟榔  ·  typescript - Vue : ...·  3 年前    · 

This browser is no longer supported.

Upgrade to Microsoft Edge to take advantage of the latest features, security updates, and technical support.

Download Microsoft Edge More info about Internet Explorer and Microsoft Edge

This topic shows how convert a C++ Standard Library string ( <string> ) to a String .

Example

// convert_standard_string_to_system_string.cpp
// compile with: /clr
#include <string>
#include <iostream>
using namespace System;
using namespace std;
int main() {
   string str = "test";
   cout << str << endl;
   String^ str2 = gcnew String(str.c_str());
   Console::WriteLine(str2);
   // alternatively
   String^ str3 = gcnew String(str.data());
   Console::WriteLine(str3);

See also

Using C++ Interop (Implicit PInvoke)