Question: This assignment will focus on reading and writing files, man pages, and conditional compilation to turn on various features. Task 1 : Implement a version
This assignment will focus on reading and writing files, man pages, and conditional compilation to turn on various features.
Task : Implement a version of the program that we wrote in class. The program should act as a "filter" program, taking in no command line arguments, but reading in any file that we redirect to it on the comment line. For example, you should be able to write:
a file.txt
and it will read in file.txt character by character. All this code needs to do is output the file to the screen without modifying anything.
Task : Use conditional compilation to implement a version of the code in Task that will output a "switched case" version of this file. All uppercase letters should be switched to lowercase, and all lowercase letters should be switched to uppercase. If everything works correctly, you should be able to run the following:
a input.txt output.txt
and your output should end up in output.txt You should compile this version of the code using the target "switched" in your Makefile.
Task : Use conditional compilation to implement a version of the code in Task that doesn't write the switched case output to the screen, but instead writes it to a temp file. I then want you to read the temp file backwards and display the file to the screen backwards ie in reverse order This will involve using the man pages, and looking into fseek, SEEKEND, SEEKCUR, etc. You might also want to look at the man page for toupper for Task as that will probably help you with determining if a letter is uppercase or not. You should be able to compile this version of the code using a Makefile with the target "reversed".
Deliverables: Your deliverable for this assignment are:
A single tgz file containing:
a single Makefile with multiple different targets for various conditional compilation situations.
one source code file that can be compiled to run either Task Task or Task using different conditional compilation conditions macro definitions in the Makefile and source code.
a "code diary" documenting your approach to the code and your coding process.
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
