C Program to convert all letters from a text file to Lower Case

This page has a C Program to convert all letters from a text file to Lower Case. It is clear that, this program has to read all the content from an existing file as input (the text file must be created earlier either through notepad or ms-word or by any other way).Then, the program will convert the letters of contents into Lower case. The below given C program is used to convert all letters from a text file into Lower Case. Kindly check out the program to convert all letters from a text file into Lower Case.

How can ask to convert all letters from a text file to Lower Case

The questions to convert all letters from a text file to Lower Case can be asked as, 1). C program to convert all the letters from a text file into Lower Case. 2). C Program to convert the letters from a data file to Lower Case. 3). C Program to convert letters available from a text file to Lower Case. 4). C Program to convert all letters to Lower Case in a text file. 5). C program to convert all letters to Lower Case in a data file. 6). C program to convert all letters present in a text file to Lower Case.

Program to convert all letters from a text file to Lower Case

#include<stdio.h>

int main(){

FILE *fpoint1, *fpoint2;

char fchar1, fchar2;

char name1[20], name2[20];

clrscr();

printf("

Give the Existing file name to Read:");

gets(name1);

printf("

Give the file name for the lower case of existing file contents :");

gets(name2);

fpoint1 = fopen(name1, "r");

fpoint2 = fopen(name2, "w");

if (fpoint1 == NULL)

printf("

The file %s has no content !", name1);

else

{

do {

fchar1 = getc(fpoint1);

fchar2 = tolower(fchar1);

fputc(fchar2, fpoint2);

} while (fchar1 != EOF);

fcloseall();

}

getch();

return (0);

}

Sample Outputs: To run the above program, we should Create a Text (data) file as input either by using any Text editor (for example: notepad or notepad++ or Ms-word) before to run the program. If input text file is not created earlier for using it in the program with 'r' mode, the program will give the output as "This file has no content !