fopen(), fclose(), gets() and fputs() functions are file handling functions in C programming language. Please find below the description and syntax for each above file handling functions
MODE OF OPERATIONS PERFORMED ON A FILE IN C LANGUAGE:
There are many modes in opening a file. Based on the mode of file, it can be opened for reading or writing or appending the texts. They are listed below.
r – Opens a file in read mode and sets pointer to the first character in the file. It returns null if file does not exist.
w – Opens a file in write mode. It returns null if file could not be opened. If file exists, data are overwritten.
a – Opens a file in append mode. It returns null if file couldn’t be opened.
r+ – Opens a file for read and write mode and sets pointer to the first character in the file.
w+ – opens a file for read and write mode and sets pointer to the first character in the file.
a+ – Opens a file for read and write mode and sets pointer to the first character in the file. But, it can’t modify existing contents.
OTHER INBUILT FILE HANDLING FUNCTIONS IN C PROGRAMMING LANGUAGE:
C programming language offers many other inbuilt functions for handling files. They are given below. Please click on each function name below to know more details, example programs, output for the respective file handling function.