Question: 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

I implemented wc command like linux haveit can count word, lines, andcaractor corectly, but there are problem with order of command line argument

-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

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 Programming Questions!