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.
http://stackoverflow.com/questions/415214/fixed-length-strings-or-structures-in-c
and
http://stackoverflow.com/questions/2871/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).