我希望在C ++ / CLI中向void*
写一个MemoryStream
缓冲区。由于我不认为这是可能的直接,或者我想将此缓冲区转换为array<byte>^
,以便能够调用Stream.Write()
。我查看了Marshal
,但后来我无法将void*
转换为System::IntPtr
。任何帮助表示赞赏。
答案 0 :(得分:2)
我无法将void *转换为System :: IntPtr。任何帮助表示赞赏。
您可以使用IntPtr constructor which takes a void*
:
void* voidPointer = GetTheVoidPointer();
System::IntPtr intPointer(voidPointer);