如何在cli / c ++中将unsigned char *转换为字节数组

时间:2014-05-21 15:01:59

标签: arrays pointers char byte unsigned

我知道如何将字节数组转换为unsigned char *。我怎么能这样做呢? 我不知道unsigned char *的长度。

我想做的事情就像 -

unsigned char *ptr_data = "The size of this value is unknown";
System::IntPtr ptr = (System::IntPtr)ptr_data;
System::String^ str_data = Marshal::PtrToStringAuto(ptr);
array<Byte>^ bytes = System::Text::Encoding::->GetBytes(str_data);

0 个答案:

没有答案