I have a managed array:
array<unsigned char>^ myGcArray;
Assume the array is null terminated. I want to display the contents using Console::WriteLine()
. What's the easiest way to convert myGcArray
to String
?
One of the constructors to String
has a parameter of const char*
, so if I can convert myGcArray
to that, then it would work too. How should I do that?
I can copy the contents of myGcArray
to a regular unsigned char myarray[]
, but is that the best way?
Thank you.
You have to use the proper encoding. If you have no idea then get started with
String^ str = System::Text::Encoding::Default->GetString(myGcArray);
by Hans Passant
Collected from the Internet
Please contact [email protected] to delete if infringement.
Comments