Hello,
I'm trying to translate the following code from C++ to C#
`
struct tPacket
{
WORD size;
WORD opcode;
BYTE securityCount;
BYTE securityCRC;
}
...
static char data[8192] = {0};
tPacket * packet = (tPacket *)data;`
so far I've come up with:
C#
public struct tPacket
{
public ushort size;
public ushort opcode;
public byte securityCount;
public byte securityCRC;
}
public static byte[] data = new byte[1024];
tPacket packet = new tPacket();
packet = (tPacket *)data;
However,I get an error "Cannot convert type 'byte[]' to 'MyNameSpace.tPacket*"
The whole code is used to put a received packet buffer(data) into a structure then directly access the structure members. Any help will be appreciated! Thanks in advance.