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

Answer:

No.

Notepad is written to read bytes that encode characters.


HEX Dump

hex dump of a file

The screen shot 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 above 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 105 has you write a hex dump program.)

The program writes eight zeros followed by a colon to designate byte zero of the file. The next 16 groups of two chracters show the bit pattern of all 16 bytes of the file. I drew in the red brackets under the bytes for each int. Four ints were written to the file, so there are four brackets.

This all there is in the file. Just these 16 bytes which were written by the program. There is nothing that says the bytes are int or short or whatever. The disk directory that the operating system maintains holds infomation about the file location on disk, its date of creation, and other aspects.

Notice that nothing separates the ints. The four bytes of one int immediately follows the previous. The spaces in the hex dump are for display purposes and do not correspond to anything in the file.

The characters at the right of the line is an attempt to interpret the individual bytes of the file as characters. For a text file, you would see the characters the bytes correspond to. However, in our file none of the bytes make sensible characters.


QUESTION 6:

In a hex dump, 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?


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