Here is source code of the C Program to convert the content of file to lowercase. The C program is successfully compiled and run on a Linux system. The program output is also shown below.
* C Program to Convert the Content of File to LowerCase
int to_lower_file(FILE *);
void main(int argc, char * argv)
int op = -1;
if (fp = fopen(argv, "r+"))
printf("FILE has been opened..!!!\n");
op = to_lower_file(fp);
printf(" %d \n", op);
printf(" %d\n ", op);
int to_lower_file(FILE *f)
while ((ch = fgetc(f))! = EOF)
c = (int)ch;
if (c >= 65 && c <= 90)
ch = ch + 32;
fseek(f, -1L, 1);
$ gcc file4.c $ cat test1 THE FUNCTION STRERROR RETURNS A POINTER TO AN ERROR MSG STRING WHOSE CONTENTS ARE IMPLEMENTATION DEFINED. THE STRING IS NOT MODIFIABLE AND MAYBE OVERWRITTEN BY A SUBSEQUENT CALL TO THE STRERROR FUNCTION. $ ./a.out test1 FILE has been opened..!!! 0 $ cat test1 the function strerror returns a pointer to an error msg string whose contents are implementation defined. the string is not modifiable and maybe overwritten by a subsequent call to the strerror function.
Sanfoundry Global Education & Learning Series – 1000 C Programs.