我有一个array<unsigned char>^
,其中包含一些ascii字符,我想将其转换为String^
。什么是最有效的方法?
答案 0 :(得分:2)
找到解决方案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);