I am looking to write a void*
buffer to a MemoryStream
in a C++/CLI. As I don't think this is possible directly, alternatively I would like to convert this buffer to an array<byte>^
in order to be able to call Stream.Write()
. I've looked at Marshal
but then I am having trouble coverting void*
to System::IntPtr
. Any help is appreciated.
views:
13answers:
1
+1
A:
I am having trouble coverting void* to System::IntPtr. Any help is appreciated.
You can use the IntPtr constructor which takes a void*
:
void* voidPointer = GetTheVoidPointer();
System::IntPtr intPointer(voidPointer);
Reed Copsey
2010-10-12 21:37:51
Oh, it never occurred to me it could be this simple. Thanks a lot! And it was quick too!
wpfwannabe
2010-10-12 21:53:54