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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started