Topics Covered
1. Commandline arguments2. How to properly call a function
3. Using manpages
Watch Video Part 3a >>
Watch Video Part 3b >>
Downloads
fahr.c
Exercises
1. The program as written (fahr.c) expects exactly three parameters, LOWER, UPPER and STEP. What happens on your machine if you run the program with fewer than three parameters?2. Modify the program fahr.c to print a "Usage" line in case the user gives the incorrect number of command-line arguments.
3. Modify the program further to accept a switch `--version' which will print the name of the program and a version number which you will define as the programmer. Use a #define directive in the top section of your source file to define the version number. An example of using this option might look like this:
C:\>fahr.exe --version
Fahr Temperature Conversion Utility, 2012, v. 0.000.001
To discover whether argv[1] matches the string "--version", use the manual pages to locate the correct function for comparing strings. Use the Apropos search mode of the manual pages and try searching on "compare strings".
No comments:
Post a Comment