Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Purpose The purpose of this assignment is to provide practice using the system calls we discussed for working with files on a UNIX system. You

Purpose 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 a. Your program must be able to handle any number of files, which will have their filenames passed as command line arguments. b. No matter how long each file is, your program must be able to read and output all of the data in contains. c. 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. d. 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.) e. Make sure to clean up after you are done with each file, calling close on its file descriptor. f. 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 -. g. 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. h. 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_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

DB2 Universal Database V7.1 Application Development Certification Guide

Authors: Steve Sanyal, David Martineau, Kevin Gashyna, Michael Kyprianou

1st Edition

0130913677, 978-0130913678

More Books

Students also viewed these Databases questions

Question

7. Provide appropriate remediation when students fail.

Answered: 1 week ago

Question

1. Why do people tell lies on their CVs?

Answered: 1 week ago

Question

2. What is the difference between an embellishment and a lie?

Answered: 1 week ago