Assigned: Thursday, October 2, 2003
Due AT THE START OF CLASS on Thursday, October 16, 2003
You need to hand in a concisely written description of your approach, your actual source code including comments, a summary of program output, and any work you did to check and verify the results.
An embedded system has created a binary data file. The file first contains a two byte integer (stored in binary), followed by a sequence of binary data values.
The initial most significant byte is:
1 | 1 | 1 | 1 | 1 | 1 | 1 | 0 |
(0xFE)
and the least significant byte is:
0 | 1 | 0 | 1 | 0 | 1 | b1 | b0 |
(0x54+b1:b0)
The least significant two bits (b0 b1) indicate how to interpret the rest of the file:
b1 | b0 |
|
0 | 0 | 2 byte (short) int |
0 | 1 | 4 byte (long) int |
1 | 0 | 4 byte float |
1 | 1 | 8 byte double |
The initial two bytes are stored in the file as a two byte short integer, so if the data is big endian the 0xFE is the first byte, while if the data is little endian the 0xFE is the second byte.
What you need to do:
You must submit an explanation of your approach, your commented C code, your verification procedure, and a summary of the results for each of the 4 test files from the class web site.