By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,652 Members | 1,696 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,652 IT Pros & Developers. It's quick & easy.

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

P: n/a
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

--
www.integrated-dev-sol.co.uk
Remove 123 from email address to reply.
Anti spam and virus measure.
Dec 6 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
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
John Swan wrote:
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

Dec 7 '05 #2

P: n/a
See http://www.codeproject.com/managedcp...gConvertor.asp

--
Regards,
Nish [VC++ MVP]
"John Swan" <j.*********@ntlworld.com> wrote in message
news:ag****************@newsfe2-win.ntli.net...
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

--
www.integrated-dev-sol.co.uk
Remove 123 from email address to reply.
Anti spam and virus measure.

Dec 7 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.