How do you convert a std::string to a System::String?

  • Thread starter Thread starter John Swan
  • Start date Start date
J

John Swan

Hello.

I cannot seem to find any documentation upon the STL string.
I am simply trying to transfer the contents of a std::string to a
System::String where I am coming into difficulties.

Any help would be appreciated.

Cheers
John
 
VC++ 2003:
std::string native_s;
System::String* managed_s = new System::String(native_s.c_str());

VC++ 2005:
std::string native_s;
System::String^ managed_s = gcnew System::String(native_s.c_str());

Tom
 
Back
Top