Files are used to store data permanently on hard disk. C programming supports built in library function to interact with files and directories. I have compiled a list of file handling exercises with solution for beginners and intermediate programmers.
Tag Archives: File handling
C program to list all files in a directory recursively
Quick links
Write a C program to list all files in a directory. How to list all files in a directory recursively. How to use readdir()
function to list all files in a directory recursively. Logic to list all files and sub-directories of a directory in C programming. How to use opendir()
, readdir()
and closedir()
library functions.
Continue reading C program to list all files in a directory recursively
C program to rename a file using rename() function
Quick links
Write a C program to rename a file using rename()
function. How to rename a file using rename()
function in C programming. rename()
function in C programming.
Continue reading C program to rename a file using rename() function
C program to check whether a file or directory exists or not
Write a C program to check whether a file or directory exists or not. How to check file or directory exists or not in C programming. What is the best way to check file or directory exists or not in C programming.
Continue reading C program to check whether a file or directory exists or not
C program to find file properties using stat() function
Quick links
Write a C program to check file properties using stat()
function. How to check file permissions, size, creation and modification date of a file in C programming. How to use stat()
function to find various file properties.
Continue reading C program to find file properties using stat() function
C program to convert uppercase to lowercase and vice versa in file
Write a C program to convert uppercase to lowercase and vice versa in file. How to convert uppercase characters to lowercase and vice versa in a file in C programming. Logic to convert uppercase characters to lowercase and vice versa in C program.
Continue reading C program to convert uppercase to lowercase and vice versa in file
C program to print source code of itself as output
Quick links
Write a C program to print source code of itself as output. How to print source code of itself as output in C programming.
Continue reading C program to print source code of itself as output
C program to replace specific line in a text file
Write a C program to input line number and replace specific line with another in text file. How to replace specific line in a text file in C programming. Logic to replace specific line with another in a text file in C program.
Continue reading C program to replace specific line in a text file
C program to find and replace a word in file
Write a C program to find and replace all occurrences of a word in file. How to find and replace a word in file in C programming. Logic to replace all occurrences of a word in file in C program.
Continue reading C program to find and replace a word in file
C program to count occurrences of all words in a file
Write a C program to count occurrences of all words in a file. Logic to count occurrences of all words in a file in C program. How to count occurrences of all words in a file in C programming. C program to count occurrences of unique words in a file.
Continue reading C program to count occurrences of all words in a file