Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Implement cat command The purpose of this assignment is to provide practice using the system calls we discussed for working with files on a UNIX

Implement cat command

The purpose of this assignment is to provide practice using the system calls we discussed for working with files on a UNIX system. You will be writing a basic implementation of the cat command using C++.

Description

As you should recall, the cat command takes a list of files as command line arguments. It then opens each file in turn, writing each files entire contents to standard output in the order they were supplied. You will be responsible for writing a C++ program that implements this behavior.

Requirements

  1. Your program must be able to handle any number of files, which will have their filenames passed as command line arguments.
  2. No matter how long each file is, your program must be able to read and output all of the data in contains.
  3. All of the data must be displayed, even if the file contains non-text data. Notice that this means cout << will not be sufficient on its own.
  4. The UNIX system calls that we spoke about in class must be used to implement the reading portion. They may be used for the writing portion as well, but this is not required. This means that the C++ file stream classes are not permitted to be used for the file input. (Use open, read, close.)
  5. Make sure to clean up after you are done with each file, calling close on its file descriptor.
  6. If - (a single dash) on its own is specified as one of the files to read and output, read the data from standard input instead. Do not open a file called -.
  7. Make sure to properly document your code. This includes a documentation box at the top of your program, as well as before each function you write, as ell as comments on the code that actually does the work, in order to explain what is going on. If documentation is missing. Your grade on the assignment will suffer.
  8. The program should compile properly with just g++ and no special flags on either turing or hopper.

What to turn in?

All you need to turn in for this assingment is the C++ source code file. Submit it via Blackboard. It is allowed to have any of the file extensions appropriate to a C++ source code file (.C, .cc, .cpp, etc.), but I recommend .cc.

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

DATABASE Administrator Make A Difference

Authors: Mohciine Elmourabit

1st Edition

B0CGM7XG75, 978-1722657802

More Books

Students also viewed these Databases questions

Question

identify the exception

Answered: 1 week ago

Question

What is the use of bootstrap program?

Answered: 1 week ago

Question

What is a process and process table?

Answered: 1 week ago

Question

What is Industrial Economics and Theory of Firm?

Answered: 1 week ago