The world’s Largest Sharp Brain Virtual Experts Marketplace Just a click Away
Levels Tought:
Elementary,Middle School,High School,College,University,PHD
| Teaching Since: | May 2017 |
| Last Sign in: | 399 Weeks Ago, 1 Day Ago |
| Questions Answered: | 66690 |
| Tutorials Posted: | 66688 |
MCS,PHD
Argosy University/ Phoniex University/
Nov-2005 - Oct-2011
Professor
Phoniex University
Oct-2001 - Nov-2016
Programming Assignment # 1
C and UNIX
Â
The purpose of this assignment is to get you more familiar with Unix/Linux and those constructs of C that are not part of C++.
Write a C program (on a Unix/Linux system) that counts and displays the number ofwords,non-white space characters, and/orlinesin a text file. The name of the input file is to be provided to the program as a command line argument. In addition, the program takes option flags to determine what actions to take. The command format is as follows:
command [-clw]inputfile
where the presence of a flag indicates the following actions:
|
|
c: display the number of characters ininputfile. |
|
|
l: display the number of lines ininputfile. |
|
|
w: display the number of words ininputfile. |
Flags can be specified in any order. If no flags arespecifyed, the command will by default display the number of characters, words, and lines. For any other format, the program should generate an appropriate error message. Similarly, if the input file can notbe read the program should generate an appropriate error message.
For this project, I highly recommend that you use one of the commonUnixeditors: vi,emacs, or Pico. Check out these references for thevieditorandemacsandpico
Be sure to document your program. Documentation should include: (1) The name of the author of the program (your name) and the date it was written, (2) a concise description of what the program does, (3)a clear description of its limitations if it does not meet all specifications, and (4) comments of critical code and data declarations. The same should also be done for each function written in the program. I will not grade any program that does not include the name of its author or a description of what it does.
Hel-----------lo -----------Sir-----------/Ma-----------dam-----------Tha-----------nk -----------You----------- fo-----------r u-----------sin-----------g o-----------ur -----------web-----------sit-----------e a-----------nd -----------and----------- ac-----------qui-----------sit-----------ion----------- of----------- my----------- po-----------ste-----------d s-----------olu-----------tio-----------n.P-----------lea-----------se -----------pin-----------g m-----------e o-----------n c-----------hat----------- I -----------am -----------onl-----------ine----------- or----------- in-----------box----------- me----------- a -----------mes-----------sag-----------e I----------- wi-----------ll