File Handling Introduction In C

The C I/O system supplies a consistent interface to the C programmer independent of the actual device being accessed. That is, the C I/O System provides a level of abstraction between the programmer and the device being used. This abstraction is called Stream and the actual device is called a file.

The functions used to read and write a file are very similar, but there are several important differences between file I/O and console I/O (the term console here refers to the screen keyboard pair ). These differences are :

  • • The console always exists;a particular file may or may not exist.
  • • In case of a console, the program reads from the keyboard and writes onto the screen. In case of files ,it is possible to read from and write to the files. In c, there are two different types of data files: stream oriented data files and system oriented data files.
    In c,there are two different types of data files:stream oriented data files and system oriented data files.
  • • Stream oriented data files can be subdivided in to two catagories.The first category is text files, consisting of consecutive characters. The second Category is uniformatted data files,organizes data into blocks containing contiguous bytes of information.
  • • System oriented data files are more closely related to the computer’s operating system.

File I/O is always done in a program in the following sequence:

  • • Open the file
  • • Read or write to the file
  • • Close the file


About the Author



Silan Software is one of the India's leading provider of offline & online training for Java, Python, AI (Machine Learning, Deep Learning), Data Science, Software Development & many more emerging Technologies.

We provide Academic Training || Industrial Training || Corporate Training || Internship || Java || Python || AI using Python || Data Science etc





 PreviousNext