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

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);

DONT NEED CODE FILE

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

Databases A Beginners Guide

Authors: Andy Oppel

1st Edition

007160846X, 978-0071608466

More Books

Students also viewed these Databases questions

Question

3. Where is the job to be accomplished?

Answered: 1 week ago