Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

code in C Write a program that accepts the name of a file from of the command line when starting the program. Once running, the

code in C

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.

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_2

Step: 3

blur-text-image_3

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

Fundamentals Of Database Systems

Authors: Ramez Elmasri, Shamkant B. Navathe

7th Edition Global Edition

1292097612, 978-1292097619

More Books

Students also viewed these Databases questions

Question

How do we organise for international logistics?

Answered: 1 week ago

Question

What are the logistics implications of internationalisation?

Answered: 1 week ago