Click here to Skip to main content
14,733,890 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
How do i convert a char to a System::String^?

I have this:

System::String^ text;
 text = UART_WriteBuffer[UART_WriteIndexTail].ToString();

where UART_WriteBuffer is a char[] and it contains "at\r". UART_WriteIndexTail ranges from 0 to 2.

I want text to contain "a" after the conversion but it contains "97" the ASCII value of "a" represented as a string.
Updated 27-Jan-10 6:46am

Easy way to do this is to create String^ from the character array and use the indexer on string.
String^ text = gcnew String(UART_WriteBuffer);
Now you can write text[UART_WriteIndexTail].ToString()
If you need a single character then you may do
System::String ^ text = gcnew String("");
str += (wchar_t) a[0];


This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900