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

This page has a C Program to convert all letters from a text file to Upper Case. It is clear that, this program will read the content from an existing file as input (the data files 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 upper case. The below given C program is used to convert all letters from a text file into Upper Case. Kindly check out the program to convert all letters from a text file into Upper Case.

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

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

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

#include<stdio.h>

int main(){

FILE *fpointer1, *fpointer2;

char filechar1, filechar2;

char nam1[20], nam2[20];

clrscr();

printf("

Give the Existing file name to Read:");

gets(nam1);

printf("

Give the file name to write the upper case of existing file contents :");

gets(nam2);

fpointer1 = fopen(nam1, "r");

fpointer2 = fopen(nam2, "w");

if (fpointer1 == NULL)

printf("

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

else

{

do {

filechar1 = getc(fpointer1);

filechar2 = toupper(filechar1);

fputc(filechar2, fpointer2);

} while (filechar1 != EOF);

fcloseall();

}

getch();

return (0);

}

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