Data File - Storage Types of Data File

Storage Types of Data File

The data files can be stored in two ways:

  1. Text files.
  2. Binary files.

A text file (also called ASCII files) stores information in ASCII characters. A text file contains visible characters. We can see the contents of file on the monitor or edit it using any of the text editors. In text files, each line of text is terminated,(delimited) with a special character known as EOL (End of Line) character. In text files some internal translations take place when this EOL character is read or written.

Examples of text files

  • A file containing a C++ program

A binary file is a file that contains information in the same format in which the information is held in memory i.e. in the binary form. In binary file,there is no delimiter for a line. Also no translations occur in binary files. As a result,binary files are faster and easier for a program to read and write than the text files. As long as the file doesn't need to be read or need to be ported to a different type of system,binary files are the best way to store program information.

Examples of binary files

  • An executable file
  • An object file

In C++, a file, at its lowest level, is interpreted simply as a sequence, or stream, of bytes. One aspect of the file I/O library manages the transfer of these bytes. At this level, the notion of a data type is absent. On the other hand, file, at user level, consists of a sequence of possibly intermixed data types——characters, arithmetic values, class objects. A second aspect of file I/O library manages the interface between these two values.

Read more about this topic:  Data File

Famous quotes containing the words storage, types, data and/or file:

    Many of our houses, both public and private, with their almost innumerable apartments, their huge halls and their cellars for the storage of wines and other munitions of peace, appear to me extravagantly large for their inhabitants. They are so vast and magnificent that the latter seem to be only vermin which infest them.
    Henry David Thoreau (1817–1862)

    He types his laboured column—weary drudge!
    Senile fudge and solemn:
    Spare, editor, to condemn
    These dry leaves of his autumn.
    Robertson Davies (b. 1913)

    This city is neither a jungle nor the moon.... In long shot: a cosmic smudge, a conglomerate of bleeding energies. Close up, it is a fairly legible printed circuit, a transistorized labyrinth of beastly tracks, a data bank for asthmatic voice-prints.
    Susan Sontag (b. 1933)

    A common and natural result of an undue respect for law is, that you may see a file of soldiers, colonel, captain, corporal, privates, powder-monkeys, and all, marching in admirable order over hill and dale to the wars, against their wills, ay, against their common sense and consciences, which makes it very steep marching indeed, and produces a palpitation of the heart.
    Henry David Thoreau (1817–1862)