Convert Uppercase to Lowercase File Handling coderinme

Convert Uppercase to Lowercase File Handling coderinme

Convert Uppercase to Lowercase File Handling coderinme
A file represents a sequence of bytes on the disk where a group of related data is stored. File is created for permanent storage of data. It is a ready made structure.
Note: We create a separate input file.
Write a program that read a text file and creates another text files by replacing all uppercase letters by their uppercase equivalent.

#include<stdio.h>
#include<stdlib.h>
#include<ctype.h>
int main()
{
FILE *myfile,*outfile;
char c;
myfile = fopen("input.txt", "r");
outfile = fopen("output.txt","w");
printf("\n");
if (myfile == NULL)
{
printf("Input File doesn't exist");
getch();
exit(0);
}
else
{
do
{
c = fgetc(myfile);
c = tolower(c);

fprintf(outfile,"%c",c);
putchar(c);
}
while (c != EOF);
}
fclose(myfile);
fclose(outfile);
getch();
return 0;
}

For more programs in C, visit our C Coder Archives

Convert Uppercase to Lowercase File Handling coderinme

Convert Uppercase to Lowercase File Handling coderinme

All rights reserved. No part of this Post may be copied, distributed, or transmitted in any form or by any means, without the prior written permission of the website admin, except in the case of brief quotations embodied in critical reviews and certain other noncommercial uses permitted by copyright law. For permission requests, write to the owner, addressed “Attention: Permissions Coordinator,” to the admin @coderinme

Leave a reply:

Your email address will not be published.