Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

THIS MUST BE DONE IN C++. PLEASE DO BOTH TASKS. DO NOT LEAVE OUT WRITE() OR COPY OTHER CODES. AN ERROR MESSAGE MUST BE PRESENT

THIS MUST BE DONE IN C++. PLEASE DO BOTH TASKS. DO NOT LEAVE OUT WRITE() OR COPY OTHER CODES. AN ERROR MESSAGE MUST BE PRESENT FOR EVERY SINGLE COMMAND, IN BOTH TASKS. THAT MEANS 4 ERROR MESSAGES PER TASK. C++ ONLY. as simple as possible please. if any direction is followed incorrectly (as all other postings of this are), you'll get a downvote. I appreciate the help, but it doesn't help if anything's left out.

image text in transcribed

Task 1(50 points ) Implement a program to display a file's contents. It should be similar to the UNIX cat command when given a single file. Name your command show. It should have the following syntax: $./show fileName The above program displays the contents of the file named fileName. Each system call must have error checking, and print an error message if it occurs. You must use open(), read(), write() and close() system calls. 10 points each. Task 2(50 points ) Modify the above program to implement a program called body similar to UNIX commands head or tail. It should print from the mth line to the nth line of the given file. It should have the following syntax: $./ body m n fileName The above program displays the contents of the file named fileName, from line m to line n. Each system call must have error checking, and print an error message if it occurs. You must use open (), read (), write(), and close() system calls. 10 points each

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

Advances In Spatial And Temporal Databases 10th International Symposium Sstd 2007 Boston Ma Usa July 2007 Proceedings Lncs 4605

Authors: Dimitris Papadias ,Donghui Zhang ,George Kollios

2007th Edition

3540735399, 978-3540735397

More Books

Students also viewed these Databases questions

Question

Define Administration and Management

Answered: 1 week ago

Question

Define organisational structure

Answered: 1 week ago

Question

Define line and staff authority

Answered: 1 week ago

Question

Define the process of communication

Answered: 1 week ago

Question

Explain the importance of effective communication

Answered: 1 week ago

Question

d. How were you expected to contribute to family life?

Answered: 1 week ago