codescracker


c++

C++ Files



« Previous Tutorial Next Tutorial »


Files are required to store any information permanently, for later use. The same holds for data files also.

The data files are the files that store data pertaining to a specific application, for later use. The data files can be stored in the following two ways :

  1. Text files
  2. Binary files

Text file

A text file stores the information in ASCII characters. In text files, each line of text is terminated or delimited with a special character named EOF known as End of Line character.

In text files, some internal translations take place when this EOF character is read or written.

Binary file

A binary file is just a file that contains information in the same format in which the information is held in memory.

In binary file, there is no delimiter for a line. Also no translations occur in binary file. As a result, binary files are faster and easier for a program to read and write than are text files. As long as the file doesn't need to be read by people or need to be ported to a different type of system, binary files are the best way to store program information.

More Examples

You can practice some C++ example programs, listed here, uses files:


« Previous Tutorial Next Tutorial »



Tools
Calculator

Quick Links
Signup - Login - Give Online Test