我尝试使用memcpy组合两个数组, 像这样:
array<short, 1>^ memTemp = gcnew array<short, 1>(8);
GCHandle handleOnData0 = GCHandle::Alloc(memTemp, GCHandleType::Pinned);
unsigned char* ptrOnData0 = (unsigned char*)handleOnData0.AddrOfPinnedObject().ToPointer();
array<short, 1>^ array1 = gcnew array<short, 1>{1, 2, 3, 4};
GCHandle handleOnData1 = GCHandle::Alloc(array1, GCHandleType::Pinned);
unsigned char* ptrOnData1 = (unsigned char*)handleOnData1.AddrOfPinnedObject().ToPointer();
array<short, 1>^ array2 = gcnew array<short, 1>{1, 2, 3, 4};
GCHandle handleOnData2 = GCHandle::Alloc(array2, GCHandleType::Pinned);
unsigned char* ptrOnData2 = (unsigned char*)handleOnData2.AddrOfPinnedObject().ToPointer();
memcpy(ptrOnData0, ptrOnData1, 8);
memcpy(ptrOnData0 + 8, ptrOnData2, 8);
handleOnData0.Free();
handleOnData1.Free();
handleOnData2.Free();
这样做可以吗?