Read Binary File HW Hints

twhalen@bec315dl14:~/homework/binary file reader$ od -t x1 -t a -t f4 -t d2 tracks.dat
0000000  00  00  00  42  00  00  ea  c2  64  00  41  42  4c  45  00  09
        nul nul nul   B nul nul   j   B   d nul   A   B   L   E nul  ht
                     32            -117        48.25038   1.5440023e-33
              0   16896       0  -15638     100   16961   17740    2304
0000020  00  00  02  42  00  80  ea  c2  c8  00  42  41  4b  45  52  06
        nul nul stx   B nul nul   j   B   H nul   B   A   K   E   R ack
                   32.5         -117.25       12.125191    3.954752e-35
              0   16898  -32768  -15638     200   16706   17739    1618
0000040  66  66  02  42  00  00  ec  c2  00  00  43  41  54  00  00  03
          f   f stx   B nul nul   l   B nul nul   C   A   T nul nul etx
                   32.6            -118         12.1875   3.7616196e-37
          26214   16898       0  -15636       0   16707      84     768
0000060  00  00  04  42  00  00  f0  c2  f6  ff  44  4f  57  4e  00  12
        nul nul eot   B nul nul   p   B   v del   D   O   W   N nul dc2
                     33            -120    3.305109e+09    4.048624e-28
              0   16900       0  -15632     -10   20292   20055    4608
0000100  00  00  04  42  00  00  f1  c2  0a  00  5a  00  00  00  00  12
        nul nul eot   B nul nul   q   B  nl nul   Z nul nul nul nul dc2
                     33          -120.5    8.265209e-39    4.038968e-28
              0   16900       0  -15631      10      90       0    4608
0000120

Order (via rows)

  1. Binary number at the end is the misc data
  2. The name (ending with nul)
    • Copy into 6 character array and set last character to 0
    • Or Tell printf to only print 5 characters
      • printf("%5.5s", name);
  3. The latitude and longitude
  4. The altitude
struct Data {
   Float Latitude;
   Float Longitude;
   .
   .
   .
}

^ 16 bytes