A good answer might be:


HEX Dump

Some text editors do something special with binary files. The editor in the screen shot below shows the bit pattern in each byte of "intData.dat". This is sometimes called a hex dump because it shows bit patterns using two hexadecimal characters per byte. On a Unix system use the "od" command at the command line. On a Windows system use Developer Studio (as below) or the free editor Code-Genie http://www.code-genie.com/ to see a hex dump.

The six zeros at the beginning of the line mean that the first byte shown is byte zero of the file. I drew in the red brackets under each integer. Four integers were written to the file, so there are four brackets. Each bracket shows the four bytes of the integer. Notice that nothing separates the integers! The bit pattern of one integer follows the next with nothing in between. There is no space character or end-of-line character between the four bytes of each integer. I knew where to draw the red brackets because I knew what data the program wrote to the file. Without knowing this, there is no way to decide what bytes should be grouped together.

The first variable in the program contained a zero. The pattern above the first bracket shows the 32-bit pattern that represents zero. Each "0" in the dump stands for four bits with value zero. So the 32-bit pattern for zero is 00000000000000000000000000000000, that is, 32 zero bits.

Don't worry about these details; the idea is to show that the file contains bit patterns corresponding to the way integers are represented inside the processor. You will get much more of this stuff in a course in assembly language.

The second group is a 32-bit representation of one. The third group represents 255. The hexadecimal character "F" represents four bits with value one. So the value 255 is represented by 24 zero bits followed by 8 one bits.


The last int held minus one. What is the 32-bit representation of minus one?