Question: Description In this lab we wl be (partially) re-creating one of the core Unix programs, c, which stands tor word count.This program reads text files
Description In this lab we wl be (partially) re-creating one of the core Unix programs, c, which stands tor word count.This program reads text files and counts the number of words, characters or lines In this lab, l the input for your program will be given via the command line. See the material for Week 11 on Carmen for a reminder on how to use command line arguments. Your program will not be given any input via stdin, you should not use scanf or any other function that reads stdin. Command Line Usage The first argument for your program will be the operation mode of the program, specifying whether you'll be counting words, characters or lines. This argument can be for lines, or -c' for characters, or'-w' for words. The first argument to your pro- gram will always exist and will be one of these options The remaining arguments to your program are the filenames of the files you need to read. Yo need to open these files read them in whatever method you find suitable; and count the number of lines, characters or words depending on the first option. You should make sure to close the files as soon as you are done reading them
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
