What is data file and file handling?


What is DataFile
What is Data File

Data file and file handling
Computer programs often need large amount of input data. It is very difficult task, which has to be performed by the user. The user has to enter from keyboard each time the program is executed. If there is any mistake during data entry process, the user has to enter the entire data again. To solve this problem, the input data is stored in a file on the disk. This file is called data file. The computer program reads the data from the file and stores into variable in memory. When program terminates, contents of variables are destroyed but the input data stored in data file is not deleted (or destroyed) . The user need not to enter data each time the program is executed. However, sometimes the user has to change input data in data file.

 Similarly, computer programs often produce large output. It is not possible to view the entire output data on the screen. In this case also. Data file is used. The output of a program is stored into a data file on the disk for later use.

In file handling, program read data as input from data file. Similarly, program processes data and writes the output into a data file.

Advantages of file Handling
There are many advantages of file handling. The main advantages are:
  1. It saves time of user to enter data each time the program is executed.
  2. The input data can be checked before forwarding to the program. In this way, there less chances of errors in the output result.
  3. The execution of program becomes fast, because program has not to pause for getting input from user via keyboard. The Program directly reads the input from data file loaded in memory.
  4. The data stored in a data file (as input data) can easily be updated.
  5. A single program may read input data from many data files at the same time
  6. The output returned by one program can be permanently saved on the disk for later use.
  7. The output of a program stored on a disk in a file can be used any time without running the program.
  8. The output of program stored on a disk can easily be printed on the printer or sent by e-mails to other or it can be used for other purposes.



What is data file and file handling? What is data file and file handling? Reviewed by JD Ahmad on June 12, 2018 Rating: 5

No comments:

Powered by Blogger.