471,582 Members | 1,375 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,582 software developers and data experts.

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

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
2 1307
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
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.

Similar topics

5 posts views Thread by Karthik | last post: by
16 posts views Thread by Khuong Dinh Pham | last post: by
3 posts views Thread by Maileen | last post: by
24 posts views Thread by Marcus Kwok | last post: by
7 posts views Thread by nicolas.hilaire | last post: by
10 posts views Thread by sposes | last post: by
11 posts views Thread by Sudzzz | last post: by
4 posts views Thread by barnum | last post: by
reply views Thread by XIAOLAOHU | last post: by
reply views Thread by leo001 | last post: by
reply views Thread by lumer26 | last post: by
reply views Thread by Vinnie | last post: by
reply views Thread by lumer26 | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.