Question: Read the head command man pages, then write your own version of the head unix command. Name head - output the first part of files

Read the head command man pages, then write your own version of the head unix command.

Name

head - output the first part of files

Synopsis

head FILE [n]

Description

Print the first 10 lines of FILE to standard output.

n is an optional argument, allowing user to specify the number of lines to display.

Hints:

Program must use all C code and C libraries. No C++.

Program does not prompt the user.

All input to the program is taken through the command line.

You may assume any value for n will be an integer ( 5, 3, 22, etc )

cout characters.

Sample Usages:

head sample.cpp -- displays the first 10 lines of sample.cpp

head -- displays an appropriate usage message

head sample.cpp 3 -- displays the first 3 lines of sample.cpp

head sample.cpp 15 -- displays the first 15 lines of sample.cpp

head nofile.cpp -- displays appropriate error message if nofile.cpp doesn't exist

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!