by Dinesh Thakur Category: C Programming (Pratical)

In this program user asks to convert all characters that are contained in a file to uppercase. To make this process user need to make a file and fill up some characters in it for operation. User declares the variables. And then put up a function to open file and also fill up character in it. Then if condition checks whether the file exists or not if the condition goes true then the program will terminate because file does not exist or then after while condition checks out the file and character and put up the condition to convert it into uppercase. Display the result on the screen.

Problem Statement:

This is c program that asks user to converts all the character in file into Upper case.

  1. Declaring variable.
  2. Using control statement.
  3. Put in while condition.
  4. Display the result on the screen.

Here is C source code for Converting the Character into Uppercase. The output of this program shown below. 

#include<stdio.h>
#include<ctype.h>
void main()
{
         FILE*f1;
         char ch,fname[20],d;
         clrscr();
         f1=fopen(fname,"w");
         printf("\nEnter File Name :");
         scanf("%s",& fname);
         f1=fopen(fname,"r");
         if(f1==NULL)
            {
                  printf("File can't be Opened");
                  exit();
             }
                  while(ch!=EOF)
                         {
                               d=toupper(ch);
                               printf("%c",d);
                               ch=fgetc(f1);
                         }
                              fclose(f1);
                              getch();

Convert all Characters of File to Uppercase



About Dinesh Thakur

Dinesh ThakurDinesh Thakur holds an B.SC (Computer Science), MCSE, MCDBA, CCNA, CCNP, A+, SCJP certifications. Dinesh authors the hugely popular blog. Where he writes how-to guides around Computer fundamental , computer software, Computer programming, and web apps. For any type of query or something that you think is missing, please feel free to Contact us.