File Handling is the storing of data and in a file using a program.In C language the programs store results, and other data of the program to file using file handling in C. One such way to store the fetched information in a file. We may store into the local file system which is volatile and can be accessed every time.
File handling in C enables us to create, update, read and delete the files stored on the local file system through our C program.The following operations can be performed on a file.
Creating of the new file
Opening an existing file
Reading from the file
Writing to the file
Deleting the file
Functions for the file handling
There are many functions in the C library to open, read, write , search and close the file.A list of file function are given below :
open new or existing file
write data into the file
read data from the file
write a character into the file
read a character from the file
closes the file
set the file pointer to given position
writes an integer to file
read an integer from the file
returns current position
sets the file pointer to the beginning of the file
Opening file : fopen()
We open a file before it can be read, write or update.It loads the file from the disk and place into the buffer and the buffer provide efficiency for the read operations. The fopen() is used to open a file.