Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

question 2 Prepare a text file with several lines of text. Write a C program that reads the text file name from the user via

question 2

Prepare a text file with several lines of text. Write a C program that reads the text file name from the user via the keyboard. The C program should also read a file name that is used to store the output. Open the given text file and read lines stored in that text file. For each line, change the lowercase letters (a to z) to upper case letters (A to Z) and change the uppercase letters to lowercase letters. Write changed lines to the given output file.

Hint: (i) You can assume the maximal length of each line in the file is 1024. (ii) When you get a file name str from the user, you can use fopen(str, r) to open that file. (iii) You can use whether the return value of fgets() is NULL to juedge whether we meet the end-of-file (EOF) mark. For example, fgets(str, 1024, inFile) == NULL when the file stream inFile meets the EOF mark. (iv) The string you get from fgets() already have a at the end of the string. Therefore, when you print the string to the file, you do not need to add a after it.

(i) Please upload the source code file as the attachment. (ii) Please upload the input file and output file of your sample run as the attachments.

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Probabilistic Databases

Authors: Dan Suciu, Dan Olteanu, Christopher Re, Christoph Koch

1st Edition

3031007514, 978-3031007514

More Books

Students also viewed these Databases questions

Question

Why does tax planning analysis focus on the marginal tax rate?

Answered: 1 week ago