tags:

views:

66

answers:

1

Hello There,

How can i convert interoperatability between a c++/CLI Array and a native c++ array AND VICE VERSA.

array^ Cpluspluss_CLI_ManagedArray;

unsigned char* UnmanagedArray;

I found the System::Runtime::InteropServices::Marshal; (IntPtr) there is so much of information for a first timer like me (to CLI) So I'm not sure about which one to use.

Thank you

Raj

A: 

// unmanaged to managed...

IntPtr ptr((unsigned char*)UnmanagedArray);

array< Byte>^Cpluspluss_CLI_ManagedArray = gcnew array(UnmanagedArrayLength);

Marshal::Copy(ptr, Cpluspluss_CLI_ManagedArray, 0, UnmanagedArrayLength);

// unmanaged to managed... See this Post

Raj