I am new to coding so i really appreciate the help. Here is the problem. Have a
ID: 3533911 • Letter: I
Question
I am new to coding so i really appreciate the help. Here is the problem.
Have a program prompt the user for a filename to open. Change every alphabetic character in the file to a capital letter. Numbers and special characters should not be changed. Print the output to the screen.
Here is my code so far but i am only returning the last line of text capitalized from the file. I am trying to get the program to display all of the three lines of text from the file capitalized. The program displays the file correctly before i try and convert everything toupper();
Thanks in advance for the help but only use toupper(); to cycle through the array. Please do not use ASCII values -32
01 #include <stdio.h>
Explanation / Answer
02 #include <stdlib.h> 03 #include <conio.h> 04 #include <ctype.h> 05 #include <string.h> 06 07 int main() 08 { 09 char line[81], filename[21]; 11 int i; 12 FILE *inFile; 13 14 printf(" Please enter the name of a file: "); 15 gets(filename); 16 inFile = fopen(filename, "r+");//r+ mode used to modify the content of file 17 if (inFile == NULL) 18 { 19 printf(" The file %s was not successfully opened.", filename); 20 printf(" Please check that the specified file exists."); 21 getch(); 22 exit(1); 23 } 24 while (fgets(line, 81, inFile) != NULL){ 25 printf(" %s", line); 01 #include <stdio.h> Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.