Lower Case To Upper Case
Given a text file(gfg.txt), our task is to convert all the lower case characters of file into upper case.
Input: (content inside file (gfg.txt) Geeks Classes: An extensive classroom programme by GeeksforGeeks to build and enhance Data Structures and Algorithm concepts Output: (content inside file (gfg.txt) GEEKS CLASSES: AN EXTENSIVE CLASSROOM PROGRAMME BY GEEKSFORGEEKS TO BUILD AND ENHANCE DATA STRUCTURES AND ALGORITHM CONCEPTS
Open the file gfg.txt in read mode. Check if there is any error in opening or locating a file. If yes, then throw an error message.
If the file is found, then with the help of while loop, convert all the characters using toupper of that file into upper case.
Close the file using fclose() function by passing the file pointer in it.
GEEKS CLASSES: AN EXTENSIVE CLASSROOM PROGRAMME BY GEEKSFORGEEKS TO BUILD AND ENHANCE DATA STRUCTURES AND ALGORITHM CONCEPTS
Upper Case to Lower Case:
Similar as above only using tolower function in place of toupper
Input: (content inside file (gfg.txt) Geeks Classes: AN EXTENSIVE CLASSROOM PROGRAMME BY GEEKSFORGEEKS TO BUILD AND ENHANCE DATA STRUCTURES AND ALGORITHM CONCEPTS Output: (content inside file (gfg.txt) geeks classes: an extensive classroom programme by geeksforgeeks to build and enhance data structures and algorithm concepts
geeks classes: an extensive classroom programme by geeksforgeeks to build and enhance data structures and algorithm concepts
1. Run this program offline by making the file gfg.txt and store some characters in it.
2. Make sure that you have made the file with the same name as that used in code and within the same folder where your program is stored.
Attention reader! Don’t stop learning now. Get hold of all the important DSA concepts with the DSA Self Paced Course at a student-friendly price and become industry ready.
- Check whether the given character is in upper case, lower case or non alphabetic character
- C program to copy contents of one file to another file
- C program to check whether the file is JPEG file or not
- Menu-Driven program using Switch-case in C
- Data type of case labels of switch statement in C++?
- Output of C programs | Set 30 (Switch Case)
- Using range in switch case in C/C++
- Nested switch case
- Lex program to take input from file and remove multiple spaces, lines and tabs
- C program to find and replace a word in a File by another given word
- C program to reverse the content of the file and print it
- Write a C program that displays contents of a given file like 'more' utility in Linux
- C Program to count number of lines in a file
- C Program to print contents of file
- C Program to merge contents of two files into a third file
- C program to delete a file
- C program for file Transfer using UDP
- LEX program to add line numbers to a given file
- C Program to find size of a File
- Lex Program to print the total characters, white spaces, tabs in the given input file
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.