Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

C ++ 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.

What to turn in?

All you need to turn in for this assingment is the C++ source 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_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

Database Management Systems Designing And Building Business Applications

Authors: Gerald V. Post

1st Edition

0072898933, 978-0072898934

More Books

Students also viewed these Databases questions

Question

Distinguish between poor and good positive and neutral messages.

Answered: 1 week ago

Question

Describe the four specific guidelines for using the direct plan.

Answered: 1 week ago