Convert text of File to LowerCase
Write a C Program to Convert text of File to LowerCase. Here’s a Simple Program to Convert text of File to LowerCase in C Programming Language.
Below is the source code for C Program to Convert text of File to LowerCase which is successfully compiled and run on Windows System to produce desired output as shown below :
SOURCE CODE : :
/* C Program to Convert text of File to LowerCase */ #include <stdio.h> #include <errno.h> int to_lower_file(FILE *); int main() { int op = -1; char ch; char * arrr = "C:\\Users\\acer\\Documents\\file2.txt"; FILE *fp; if (fp = fopen(arrr, "r+")) { printf("FILE has been opened..!!!\n"); op = to_lower_file(fp); printf(" %d \n", op); fclose(fp); } else { perror("Error Occured"); printf(" %d\n ", op); } return 0; } int to_lower_file(FILE *f) { int c; char ch; while ((ch = fgetc(f))!= EOF) { c = (int)ch; if (c >= 65 && c <= 90) { ch = ch + 32; fseek(f, -1L, 1); fputc(ch, f); } } return 0; }
OUTPUT : :
/* C Program to Convert text of File to LowerCase */ FILE has been opened..!!! 0 INPUT IN FILE :: "HELLO FRIENDS" OUTPUT IN FILE :: "hello friends"
Above is the source code for C Program to Convert text of File to LowerCase which is successfully compiled and run on Windows System.The Output of the program is shown above .
If you found any error or any queries related to the above program or any questions or reviews , you wanna to ask from us ,you may Contact Us through our contact Page or you can also comment below in the comment section.We will try our best to reach up to you in short interval.
Thanks for reading the post….