Question
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:
- Remove the comments from the file.
- Remove any indenting from the file.
- Put line numbers in the file.
- 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
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started