472,139 Members | 1,859 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

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

C++ .NET convert character array to String

I am working on Visual C++ 2005. I have a character array (array<Char>) and want to convert it to string. I know I can do this with the String constructon (gcnew String(charArray)), but is there no other way without allocating memory? I have in mind the GetString method of System::Text::Encoding::ASCII but couldnt manage to do what I wanted to do.
Thanks in advance for any help.
Jul 3 '07 #1
2 1842
vanc
211 Expert 100+
char[] arrayofchar;
string temp;
foreach(char c in arrayofchar)
temp += c;

:D, cheers.
Jul 4 '07 #2
That was nice thanks
Jul 5 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

4 posts views Thread by David Lawson | last post: by
15 posts views Thread by Kueishiong Tu | last post: by
14 posts views Thread by rtillmore | last post: by
reply views Thread by leo001 | 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.