using namespace System::Runtime::InteropServices;
char buf[] = “Native String”;
int len = strlen(buf);
array< Byte >^ byteArray = gcnew array< Byte >(len + 2);
// convert native pointer to System::IntPtr with C-Style cast
Marshal::Copy((IntPtr)buf, byteArray, 0, len);
for converting managed array<Byte>^ to unmanaged char* click here
Leave a Reply