Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Homework must be done in C. Read the man page for the head system command : man head (https://linux.die.net/man/1/head) Then, write your own version of

Homework must be done in C.

Read the man page for the head system command : man head (https://linux.die.net/man/1/head)

Then, write your own version of the head command according to the following pseudo man page:

NAME:

head - output the first part of files.

SYNOPSIS:

head [OPTION] [FILE]

DESCRIPTION:

Print the first 10 lines of the FILE to standard output.

-nK

Print the first K lines of the file instead of 10.

EXAMPLES:

head prints the synopsis message
head file.txt prints the first 10 lines of file.txt, or all lines if fewer than 10.
head -n5 file.txt prints the first 5 lines of file.txt, or all lines if fewer than 5.

NOTES:

o When interacting with the file, you must use some combination of one or more the following Unix system calls: open, read, write, lseek, close, creat.

o The program does not prompt the user in any way.

o You may not use any C++ specific code.

HINTS:

o Any line will end with the new line character: .

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

Data Management Databases And Organizations

Authors: Richard T. Watson

3rd Edition

0471418455, 978-0471418450

More Books

Students also viewed these Databases questions

Question

1. Explain why evaluation is important.

Answered: 1 week ago