convert standard C++ string to String^
I want to convert to std::string to System::String^ in Visual C++ environment. I know that we can convert System::String to std::string by the MarshalString Function as below: void MarshalString ( String ^ s, string& os ) { using namespace Runtime::InteropServices; const char* chars = (const char*)(Marshal::StringToHGlobalAnsi(s)).ToPointer(); os = chars; Marshal::FreeHGlobal(IntPtr((void*)chars)); } I can't find the way to convert std::string to System::String but I found that System::String has constructor with argument as below : System::String(Char* value, Int32 startIndex, Int32 length)