Question: c++ create a cat.cpp. You are NOT allowed to use the exec, system, popen, and pclose system calls or functions in your implementation. You are

c++ create a cat.cpp.

You are NOT allowed to use the exec, system, popen, and pclose system calls or functions in your implementation. You are not allowed to call the existing cat implementation. You must supply your own implementation that uses low-level I/O. Low-level file I/O is a requirement.

c++ create a cat.cpp that does following:

When user types in command cat filename.txt, it allows user to enter an input and the system will echo back the user input and When ctrl + d is pressed, it exits out of cat mode and displays the contents of the file.

For example:

Assuming that filename is a text file with "c++ rules"

$ ./cat - filename

s <- user input

s <- automatically echoes back user input

dqewfqwef <- user input

dqewfqwef <- automaticcally echoes back user input

c++ rules <- When ctrl + d is pressed, it exits out of cat mode and displays the contents of the file.

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!