Hello,
As you already may know,I'm migrating into C# and some things in C++ look different.
C++ code
BYTE packetBuffer[32] = {0};
*(LPWORD)(packetBuffer + 0) = 0xC;
*(LPWORD)(packetBuffer + 2) = 0x5000;
*(LPDWORD)(packetBuffer + 6) = dwArgs[13];
*(LPDWORD)(packetBuffer + 10) = *(keyArray2 + 0);
*(LPDWORD)(packetBuffer + 14) = *(keyArray2 + 1);
Note dwArgs and keyArray2 are "array of DWORD"
This is how it's placed
- packetbuffer[0] will be 0xC
- packetbuffer[1] will be 0x00
- packetbuffer[2] will be 0x50
- packetbuffer[3] will be 0x00
and so on
How to do that in C#?
I tried this,but it doesn't work
packetBuffer[0] = 0xC;
packetBuffer[2] = (byte)0x5000; //error
packetBuffer[6] = (byte)dwArgs[13];