go to previous page   go to home page   go to next page        



HEX Dump

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 a freeware hex dump. The dump below is by the IrfanView image viewing program, a very useful program to have around. Look for it at www.irfanview.net. (One of the programming exercises for Chapter 86 has you write a hex dump program.)

hex dump of a file

The eight 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. The spaces in the hex dump are for display purposes and do not correspond to anything in the file.

The stuff at the right of the line is an attempt to interpret the individual bytes of the file as characters. Often this is useful, because character data is often embedded within "binary" files. However, in our file none of the bytes make sensible characters.


Each byte is represented with two characters. Each character is one of the 16 characters 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, A, B, C, D, E, F. How many two-character combinations are possible?