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_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

Accounting And Auditing Research And Databases Practitioner's Desk Reference

Authors: Thomas R. Weirich, Natalie Tatiana Churyk, Thomas C. Pearson

1st Edition

1118334426, 978-1118334423

More Books

Students also viewed these Databases questions

Question

What is DDL?

Answered: 1 week ago