Connecting Tech Pros Worldwide Forums | Help | Site Map

char[] to String^

Newbie
 
Join Date: May 2007
Posts: 4
#1: May 11 '07
can anyone help me how can i convert char[] to String^
thanks...

ilikepython's Avatar
Expert
 
Join Date: Feb 2007
Posts: 839
#2: May 11 '07

re: char[] to String^


Quote:

Originally Posted by ACSS

can anyone help me how can i convert char[] to String^
thanks...

Is this what you mean?
Expand|Select|Wrap|Line Numbers
  1. char myarray[] = "Hello";
  2. string mystring(myarray);
  3.  
ilikepython's Avatar
Expert
 
Join Date: Feb 2007
Posts: 839
#3: May 11 '07

re: char[] to String^


BTW, thanks for joining!
AdrianH's Avatar
Expert
 
Join Date: Feb 2007
Location: Halifax
Posts: 1,099
#4: May 12 '07

re: char[] to String^


Quote:

Originally Posted by ACSS

can anyone help me how can i convert char[] to String^
thanks...

The carat (^) is a C# modifier. C++ doesn't have this. IIRC, a type with a carat modifier means that it is garbage collected. To convert a char array to a GC String, create a GC String and then assign it the array. This may be as easy as using the assignment operator or constructor, but I'm not positive as this is a C++ forum. ;)


Adrian
Newbie
 
Join Date: May 2007
Posts: 4
#5: May 19 '07

re: char[] to String^


thanks for all...
i think i understand.
Reply