How to write a c program to read a char & print next char ( file to file ) in C Programming Language ?
Solution:
/* Read a char & print next char ( file to file ) : A character should be written in the file named "readfile.txt" beforehand and we will take this as input to be manipulated and finally written into the file named "writefile.txt" */
#include <stdio.h>
int main()
{
FILE *fp,*fp1;
int ch;
fp=fopen("readfile.txt","r");
fp1=fopen("writefile.txt","w+");
if(fp == NULL)
{
printf("\nThe file was not found\n");
}
while((ch = fgetc(fp)) != EOF)
{
if(ch>96 && ch<122)
{
ch++;
fprintf(fp1,"\nThe next character is %c\n", (ch));
}
else if(ch ==122)
{
fprintf(fp1,"\nThe next character is a\n");
}
}
fclose(fp1);
fclose(fp);
}
Learn More :
Char
Next
File Handling
File
- COPY DATA FROM ONE FILE TO ANOTHER FILE USING C PROGRAM
- C Program File Input & Output Example
- C Program To Destruc Self Execution File ?
- C Program To Store Students Record In A Text File
- C Program To Write Data In A File And Search Data From File
- Make a copy of file given in argv[1] to file given in argv[2]
- C Program to copy a file to another file
- C Function to read instructions from the file and obey them
- Client/Server C program to make client send the name of a file
- A small I/O bound program to copy N bytes from an input file to an output file.
- C Program to Read and Write FIFO
- File Number Control C Program Example
- C Program to opens and reads dictionary file specified in spellrc
- C Program to Recursively converts all file-names to lower-case
- C Program to Find the Size of File using File Handling Function
- C Program Recursive function that searches for a given file in a given folder
- C Program to Input Student Details into a File For Two Subjects
- Identifies the architecture Windows PE (exe or dll) file was compiled C Program
- File Handling (console to file) in C Program
print
- PRINT PRIME NUMBERS BETWEEN 1-300 USING BREAK AND CONTINUE IN C
- Write a c program to print Pascal triangle.
- C or C++ Program To Print Prime Number
- C Program print fill zero & mod/div
- C Program to printf & scanf Example
- C Program to Print a String Without Use Semicolon.
- C Program To Input & Print More Than One Words In Single Line
- C Program To Print Alphabets Like {Aa Bb Cc...}
- C Program To Print Alphabets Like {Az By Cx...}
- C Program To Print Lines Of A Paragraph Having More Than 15 Characters
- C Program To Print Prime Numbers Upto The Number You Want
- C Program To Print String In Formatted Output Form
- C Program To Print Sum Of n Digit Number
- C Program To Print Table Horizontally
- C Program To Print Tridiagonal Matrix
- C Program To Print Text Into Uppercase
- Printing ASCII Table with Numbers and corresponding characters
- C Program to print all prime numbers from 1 to 300.
- C program that lets the user choose if he wants to add a item to the shopping list or print it out
- C Program to print table vertically
- Loudness Program: Gets loudness level from user; chooses a response And prints it using logical and operative statements
- C program that receives 10 float numbers from the console and sort them in non-ascending order, and prints the result
- Function should print the cartesian coordinates of the struct argument
- Primul meu program in C Program
Read
- Sort Three Numbers - program reads in three Integers and displays them in ascending order.
- C or C++ program to read marks of 4 subjects and find how many students are pass and fail with division
- C Program readers/writers
- C Program to Demonstrates use of reader/writer lock
- C Program to Write/Read Dynamic Data Example
- C Function to read instructions from the file and obey them
- A small I/O bound program to copy N bytes from an input file to an output file.
- Input reads in the array positions and range for random generation.
- C Program to Read and Write FIFO
- pthreads Readers/Writers Lock C Program
- C Program to opens and reads dictionary file specified in spellrc
- C Program reads in and spews out the attributes of a given .wav file.
- C Program Number of Judge and Score From Each Judge
- Read 10 real numbers using a vector and show the least of them C Program
- C Program To Read A Parenthesised Infix Expression From The User And Check Whether It Is Well Parenthesised Or Not
- C Program To Read The Adjecancy Matrix of Directed Graph And Convert It Into Adjecancy List
- Menu Driven Program to Read Two Integers Find Sum, Difference and Product C Program