Question
The C programming language allows for us to easily work with files. In this question you will implement a command-line editor that is capable of
-
The C programming language allows for us to easily work with files. In this question you will implement a command-line editor that is capable of creating, displaying and manipulating text files. You have a lot of freedom in how you do this but you will need to make informed design decisions and provide justifications for these choices as part of your documentation.
-
(a) Write a C program that allows a user to perform each of the operations listed below on text files.
FILE OPERATIONS: Create File - Create a new file with a specified name. Copy File - Create a new file with a specified name and identical contents to an existing file. Delete File - Delete an existing file with a specified name. Show File - Display the contents of an existing file with a specified name.
LINE OPERATIONS: Append Line - Create a new line of content at the end of a specified file. Delete Line - Delete a line of content at a particular line number in a specified file. Insert Line - Create a new line of content at a particular line number in a specified file. Show Line - Display the contents of a file at a particular line number in a specified file.
GENERAL OPERATIONS: Show Change Log - Display the sequence of operations performed on all files created by your program, including the number of lines following each operation. Show Number of Lines - Show the number of lines in a specified file.
You must provide a command-line interface and operate on files in your current working directory but, apart from these requirements, you may implement the program in any way. You should document all design decisions not covered above, e.g., how a user specifies the operation they want to perform.
-
(b) Implement two additional operations or extensions to the operations listed above. You should provide justifications for the usefulness of the functionalities you introduce.
-
(c) Write an explanation of your C program. You should incorporate this explanation using detailed code comments and separate written explanations.
-
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