Struct {
byte F1[2]
SHORT F2
byte F3[512]
} BPD
CBD
{
SHORT CLENGTH
byte DATA[]
}
Above are 2 c++ structure. Here SHORT is of 2 byte signed. What would be the best way to convert it into C#?
(Note that in 2nd struture length of DATA is uundefined.)
I have seen following two links.
Fixed length strings or structures in C#
and
Reading a C/C++ data structure in C# from a byte array
After reading data into structure i need to covert the short variable to big endian. (reversing bytes).