File Handling in C programming language

In C language, file handling enables us to create, update, read, and delete the files stored on the local file system. The following operations can be performed on a file.
  • Creation of the new file
  • Opening an existing file
  • Reading from the file
  • Writing to the file
  • Deleting the file

Functions for file handling : There are many functions in the C library to open, read, write, search and close the file. A list of file functions are given in following table :

Functions Description
fopen() Opens new or existing file
fprintf() Write data into the file
fscanf() Reads data from the file
fputc() Writes a character into the file
fgetc() Reads a character from file
fclose() Closes the file
fseek() Sets the file pointer to given position
fputw() Writes an integer to file
fgetw() Reads an integer from file
rewind() Sets the file pointer to the beginning of the file


0 Comments