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)

    ... there are two types of happiness and I have chosen that of the murderers. For I am happy. There was a time when I thought I had reached the limit of distress. Beyond that limit, there is a sterile and magnificent happiness.
    Albert Camus (1913–1960)

    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)

    While waiting to get married, several forms of employment were acceptable. Teaching kindergarten was for those girls who stayed in school four years. The rest were secretaries, typists, file clerks, or receptionists in insurance firms or banks, preferably those owned or run by the family, but respectable enough if the boss was an upstanding Christian member of the community.
    Barbara Howar (b. 1934)