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

C++ .NET convert character array to String

P: 11
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
Share this Question
Share on Google+
2 Replies

vanc
Expert 100+
P: 211
char[] arrayofchar;
string temp;
foreach(char c in arrayofchar)
temp += c;

:D, cheers.
Jul 4 '07 #2

P: 11
That was nice thanks
Jul 5 '07 #3

Post your reply

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