Go to previous pageGo to next page

1.1.2. Binary Files

"A binary file is a file whose content must be interpreted by a program or a hardware processor that understands in advance exactly how it is formatted. [...] A program has to know exactly how the data inside the file is laid out to make use of the file." (Whatis.com)

Example of a Binary File

When opening a binary file in a texteditor, it looks like this:

Example of a Binary FileExample of a Binary File

Binary is nothing more than a numeral system. Binary files are usually thought of as being a sequence of termbytes, which means the binary digits (bits) are grouped in eights (00000001, 00000011, etc.). (Wikipedia)

You may have recognized that the example above does not include the mentioned sequences of bytes. When opening a binary file in a texteditor such as UltraEdit, it is coded using termhexadecimal values. The following table shows the coherence between the hexadecimal, the binary and the ASCII code:

Binary 00110 0001 0110 0011 0111 1000
Hexadecimal 61 63 74
ASCII 'a' 'c' 't'

Binary files may contain any data whatsoever such as plain text, images, sound, compressed versions of other files (of either type), etc. (Wikipedia)

They are also used to store data output by a program, and intended to be read by that or another program but not by humans. (Dictionary.com)

Advantages

The advantages of binary files are:

  • quicker to read (compared to plain text files)
  • better for larger datasets

Disadvantages

The disadvantages of binary files are:

  • not readable by humans
  • fixed datastructure

Furthermore it is usually necessary to write special purpose programs to manipulate such files since most general purpose utilities operate on text files. (Dictionary.com)

Usage Scenarios

As we mentioned above, binary files are used to store raster data such as images or terrain models.

Picture saved as binary filePicture saved as binary file (Atlas of Switzerland 2.0 2004)


Go to previous page
Go to next page