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

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

Building Database Driven Catalogs

Authors: Sherif Danish

1st Edition

0070153078, 978-0070153073

Students also viewed these Databases questions

Question

Differentiate tan(7x+9x-2.5)

Answered: 1 week ago

Question

Explain the sources of recruitment.

Answered: 1 week ago

Question

Differentiate sin(5x+2)

Answered: 1 week ago

Question

Compute the derivative f(x)=1/ax+bx

Answered: 1 week ago

Question

1-4 How will MIS help my career?

Answered: 1 week ago