Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Write a program that accepts the name of a file from of the command line when starting the program. Once running, the program will present

image text in transcribed

Write a program that accepts the name of a file from of the command line when starting the program. Once running, the program will present the user with a text-based menu with five options: 1. Remove the comments from the file. 2. Remove any indenting from the file. 3. Put line numbers in the file. 4. Quit. Write the functions to do the above actions. Each function should be a self-contained function. You should be able to run one action and then another on the same file (i.e., remove comments and then remove indents, without needing to re-run the program). Modifications to the file should be written back to the original file, so if we removed comments and then add line numbers, the file (when we quit) should have both removed comments and added lines numbers. Assume a C file, and assume both types of comments. For this program, you are going to want to use #include In particular, you will probably want to use fgets (char_array, number, file); So for: char line[100]; FILE *file; You would use: fgets(line, 100, file); Please note any constraints that your program might have. Test appropriately. Submit as per the submission guidelines. Write a program that accepts the name of a file from of the command line when starting the program. Once running, the program will present the user with a text-based menu with five options: 1. Remove the comments from the file. 2. Remove any indenting from the file. 3. Put line numbers in the file. 4. Quit. Write the functions to do the above actions. Each function should be a self-contained function. You should be able to run one action and then another on the same file (i.e., remove comments and then remove indents, without needing to re-run the program). Modifications to the file should be written back to the original file, so if we removed comments and then add line numbers, the file (when we quit) should have both removed comments and added lines numbers. Assume a C file, and assume both types of comments. For this program, you are going to want to use #include In particular, you will probably want to use fgets (char_array, number, file); So for: char line[100]; FILE *file; You would use: fgets(line, 100, file); Please note any constraints that your program might have. Test appropriately. Submit as per the submission guidelines

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

MongoDB Applied Design Patterns Practical Use Cases With The Leading NoSQL Database

Authors: Rick Copeland

1st Edition

1449340040, 978-1449340049

More Books

Students also viewed these Databases questions

Question

What qualities do you see as necessary for your line of work?

Answered: 1 week ago