Ok so I'm looking for a quick efficient way of reading the following binary data into memory. I'm currently reading it all and then have my own functions that break it up via the separators 0x7d (|) and read each on into a variable, however I was thinking about reading it into a class or a struct perhaps?
Any feedback or suggestions would be appreciated.
46 49 4C 45 48 45 41 44 45 52 8C 00 00 00 30 00 00 00 7C 53 54 52 49
4E 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 7C 03 00 7C 73 74 72 7C 0B 00
7C 61 6E 6F 74 68 65 72 20 73 74 72 7C 1E 00 00 00 7C 09 00 7C 30 30
30 2E 34 33 2E 32 39 7C
Break down of the above binary data is as follows;
uchar[0x0a] "46 49 4C 45 48 45 41 44 45 52 " (this is a constant file header)
ulong[0x4] "8C 00 00 00" (unsigned long value)
ulong[0x4] "30 00 00 00" (unsigned long value)
uchar[0x1] "7C" (field separator)
uchar[0x3f] "53 54 52 49
4E 47 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
00 00 00 00 00 00 00 00 00 00 00 00 00" (constant char[])
uchar[0x1] "7C" (field separator)
ushort[0x2] "03 00" (length of the next char[] after the field separator)
uchar[0x1] "7C" (field separator)
uchar[0x3] "73 74 72" (char[] length defined by previous field NOT including the field separator)
the file continues on like this, if its a char[] the pervious field will always contain a short of its length, numeric fields will always be unsigned ong 0x4 bytes etc...