Here is the listing of C programming examples on File Handling.
1. C Examples on File Creation
We frequently use files for storing information which can be processed by programs. In order to store information permanently and retrieve it we need to use files. The C programs in this section demonstrate creation of a file, Storing Information in a file and Reading the data present in the file.
C Program to Create a File & Store Information
C Program to Illustrate Reading of Data from a File
2. C Examples on File Content Deletion
The C programs in this section demonstrates deletion of contents of the file. It deletes a targeted line from a text file, it replaces a specified line in a text file and calculates the number of lines in a text file.
C Program to Delete a specific Line from a Text File
C Program to Replace a specified Line in a Text File
C Program to Find the Number of Lines in a Text File
3. C Examples on Appending and Merging the Contents of Files
The C programs in this section deals with appending and merging the contents of files. The programs joins the file contents, merges lines from different files and prints them, lists the files in a directory, depicts the function names from C source file and finds the size of the file using file handling functions. C Language provides functions like fopen, fread, fwrite, fseek for file handling.
4. C Examples on Create, Copy, Comparison and Printing the Contents of the File
The C programs in this section deals with creation, copy, comparison and printing the contents of the file. The programs print the environment variables, copy one file to another, creates an employee record and updates it, and carries comparison of two binary files.
5. C Examples on Convert, Replace, Count and Reverse Operations on the Contents of a File
The C programs in this section deals with convert, replace, count and reverse operations on the contents of a file. The programs performs conversion the contents of the file to uppercase and lowercase, performs reversal of the contents of a file, counts the number of lines and comments in a program and replaces the first letter of every word with a capital letter.
6. C Examples on Creation and Updating Operations on the Contents of the File
The C programs in this section perform creation and updation operations on the contents of the file. It updates the details of employee using files, creates employee record which is taken from the command line argument. The other programs in this section joins lines of two given files and store them in a new file and collect statistics of a source file like total lines, total number of blank lines, total no. of lines ending with semicolon.