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)

    Science is intimately integrated with the whole social structure and cultural tradition. They mutually support one other—only in certain types of society can science flourish, and conversely without a continuous and healthy development and application of science such a society cannot function properly.
    Talcott Parsons (1902–1979)

    To write it, it took three months; to conceive it three minutes; to collect the data in it—all my life.
    F. Scott Fitzgerald (1896–1940)

    I have been a soreheaded occupant of a file drawer labeled “Science Fiction” ... and I would like out, particularly since so many serious critics regularly mistake the drawer for a urinal.
    Kurt Vonnegut, Jr. (b. 1922)