Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Name this program shout.c – The program takes a single command line argument, th

ID: 3800295 • Letter: N

Question

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!    

Explanation / Answer

#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;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Chat Now And Get Quote