C++/CLI String Conversions

后端 未结 2 1728
迷失自我
迷失自我 2020-12-18 14:01

I found this really nice piece of code that converts a string to a System:String^ as in:

System::String^ rtn = gcnew String(move.c_str());  // \         


        
2条回答
  •  既然无缘
    2020-12-18 14:35

    Use VC++'s marshaling library: Overview of Marshaling in C++

    #include 
    
    // given System::String^ mstr
    std::string nstr = msclr::interop::marshal_as(mstr);
    

提交回复
热议问题