C Programming language

C File Handling
Previous Home Next

We frequently use files for storing information which can be processed by our programs. In order to store information permanently and retrieve it we need to use files. A file is collection of related data. Placed on the disk. Files are not only used for data. Our programs are also stored in files.

Why we use File Handling

The input and out operation that we have performed so far were done through screen and  keyboard only. After the termination of program all the entered data is lost because primary memory is volatile. If the data has to be used later ,then it becomes necessary to keep it in permanent storage device. so the c language provide the concept of file through which data can be stored on the disk or secondary storage device. The stored data can be read whenever required.

Types of File Handling in C

The file handling in c can be categorized in two types:

  1. High level (Standard files or stream oriented files): High level file handling is managed by library function. High level file handling commonly used because it is easier and hide most of the details from the programmer.

  2. Low level (system oriented files): Low level files handling is managed by system calls.

Previous Home Next