Write a C program to remove a given word from a text file. Logic to remove word from file in C programming. How to remove word from file in C program.
C program to copy contents from one file to another
Quick links
Write a C program to copy contents from one file to another. Logic to copy contents from one file to another file in C program. How to copy contents from one file to another using functions in C programming.
C program to compare two files
Write a C program to read contents of two files and compare them character by character. How to compare two files character by character and line by line in C programming. Logic to compare two files line by line and print difference line and column number in C program.
Example
File 1
Learn C programming at Codeforwin. Working with files and directories.
File 2
Learn C programming at Codeforwin. Working with array and pointers.
Output
File are not equal. Line: 2, column: 14
C program to append data into a file
Quick links
Write a C program to read data from user and append data into a file. How to append data at end of a file in C programming. In this post I will explain append mode in file handling. I will cover how to append data into a file in C using append file mode.
Example
Source file content
I love programming. Programming with files is fun.
String to append
Learning C programming at Codeforwin is simple and easy.
Output file content after append
I love programming. Programming with files is fun. Learning C programming at Codeforwin is simple and easy.
C program to write even, odd and prime numbers to separate file
Quick links
Write a C program to input numbers from a file and write even, odd and prime numbers to separate files. How to input numbers from file using fscanf()
and write even, odd and prime numbers to different file.
C program to read a file and display its contents
Write a C program to read a file and display its contents on console. How to read a file and display file contents on console in C programming. In this exercises, I will explain you how to read a file character by character using fgetc()
. How to read a file line by line using fgets()
.
C program to create a file and write data into file
Quick links
Write a C program to create a file and write contents in it. How to create a file in C programming? C program to input a string from user and store it in a text file. Learn how to create a file and write contents to it in C programming.
atoll() in C – Syntax, Use and Example
Quick links
Write a C program to input string from user and convert string to long long
using atoll()
library function. How to convert string to long long int
type using atoll()
library function in C programming?