Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

I implemented wc command like linux have it can count word, lines, and caractor corectly, but there are problem with order of command line argument

I implemented wc command like linux have

it can count word, lines, and caractor corectly, but there are problem with order of command line argument and file like wildcard like *.c

if you put -f file_name # of caractors and lines and words are displayed.

moreover you can put -c or -w or -l.

if you put -f file_name -c # of caracters displayed

if you put -f file_name -cl # of caraters and lines are displayed

regarding above "-f file_name -c -l" and "-c -f file_name -l" get same output

always file_name have to be after -f

image text in transcribedimage text in transcribed
-h Call a function that displays a message showing the command line options and exit with an exit value 0 {zero}. I use tabs when formatting the help output. -C Count and display:r the number of characters in the input. W Count and displayr the number of words in the input. Words are delimited by newline or whitespace. Strongly consider use of strtok 0. -1 Count and displayr the number of lines in the input. Lines in the le are newline delimited. Note that this is an lowercase L f file_name The name of the file to be processed. The name of the file will not exceed 99 characters in length. I If no file name is given on the command line (which means there is not a f command line argument}, your program must read from stdin. Such as ./mywc

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

Mobile Communications

Authors: Jochen Schiller

2nd edition

978-0321123817, 321123816, 978-8131724262

More Books

Students also viewed these Programming questions