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

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
 
T

Tamas Demjen

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top