Search code examples
c++-cliclr

array<BYTE>^ to BYTE [] exact convert


How to convert exactly:

array<BYTE>^ mntest = gcnew array<BYTE>{0x1A, 0x1B, 0x1C};
to
BYTE unmtest [] = { 0x1A, 0x1B, 0x1C };

Resp. how to initialize unmanaged BYTE array to correct size of managed array. Dynamic initialization of unmanaged array throws an error.


Solution

  • I found because dynamic initialization of static array is not allowed is conversion above possible only with using array pointer.