Name this program shoutc The program takes a single command

Name this program shout.c – The program takes a single command line argument, the name of an input file. Your program should confirm the input file exists (exiting with an appropriate error message if it does not). If the file exists, then “shout” the file to standard output. That is, print the file to standard output while converting all lowercase letters to uppercase.

contents of myData

contents of myData

  The quick brown fox jumps over the lazy old dog.  Roll Tide 1831!    
  ./a.out myData    
  THE QUICK BROWN FOX JUMPS OVER THE LAZY OLD DOG.  ROLL TIDE 1831!    

Solution

#include<stdio.h>
int main() {
FILE *fp1, *fp2;
char a[100];
fp1 = fopen(\"test1.txt\", \"r\");
if (fp1 == NULL) {
puts(\"file 1 does\'t created\");
}
fp2 = fopen(\"test2.txt\", \"w\");
if (fp2 == NULL) {
puts(\"file 2 does\'t created\");
fclose(fp1);
}

do {
a = fgetc(fp1);
a = a+32;
fputc(a, fp2);
} while (a != EOF);

fcloseall();
return 0;
}

Name this program shout.c – The program takes a single command line argument, the name of an input file. Your program should confirm the input file exists (exit

Get Help Now

Submit a Take Down Notice

Tutor
Tutor: Dr Jack
Most rated tutor on our site