Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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

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

Object Databases The Essentials

Authors: Mary E. S. Loomis

1st Edition

020156341X, 978-0201563412

More Books

Students also viewed these Databases questions

Question

Evaluate 3x - x for x = -2 Answer:

Answered: 1 week ago

Question

What is group replacement? Explain with an example. (2-3 lines)

Answered: 1 week ago