Reputation: 37518
I have a array<unsigned char>^
which contains a load of ascii characters which I'd like to convert into a String^
. What's the most efficient way to do this?
Upvotes: 2
Views: 3110
Reputation: 37518
Found a solution here:
BufferedStream file = gcnew BufferedStream(gcnew FileStream(fileName,FileMode::Open));
array<unsigned char>^ arr = gcnew array<unsigned char>(10);
file->Read(arr,0,10);
String^ s;
Text::Encoding^ enc = Text::Encoding::UTF8;
s = enc->GetString(arr);
Upvotes: 2