PROGRAM 7: ReverseIt.c ---------------------- Assigned: Thursday March 27, 2003 Deadline: Thursday April 03, 2003 at MIDNIGHT The goal of this project is to introduce you to the concepts of file I/O in UNIX. In this project you will implement a program that reads in the content of one file and outputs the content in reverse to another file. The program must run on ajax, and compile on ajax with the compiler located at /opt/sfw/bin/gcc. KEY CONCEPTS: ------------ - File I/O - read/write/open - checking for errors - command line processing - efficiency PROBLEM DESCRIPTION: ------------------- Write a program that creates a copy of a binary file with its contents written in reverse, that is with the bytes in reverse order. Consider your design carefully to find a reasonably efficient way to solve this problem. (This will be a factor in grading this program.) One very inefficient solution is to read one byte at a time from the end of the file forward. On the other hand, you are to assume that the file is too large to read entirely into memory. You may buffer at most 10K bytes of the file in memory at any one time. INPUT/COMMAND LINE: ------------------ Your program should take two command line parameters, where each parameter is the name of a file. The first parameter is the name of the input file and the second parameter is the name of the output file. Example Command Line: {ajax} ReverseIt fileToReverse.txt fileInReverse.txt {ajax} EQUIREMENTS: ----------- o This program must be written in C. Your program will be graded using the compiler on AJAX with path: /opt/sfw/bin/gcc. o All file I/O must be done using the routines described in chapter 1-3 of the text. o You may use functions from stdio.h for error messages (fprintf(stderr,...). o The programs should be robust and include appropriate error checks. OTHER REQUIREMENTS: ------------------ * Proper commented code * Modularized program * Good software engineering techniques, hints in text book. * You must submit at least the following files (i.e., all the files necessary to compile your program): README.txt ReverseIt.c Makefile To submit the files, you will need to use the submit program. Your files need to be under a common subdirectory called "1730_program7". Execute the below command line while in your home directory: submit 1730_program7 cs1730 NOTE: you need to be LOGGED ONTO ajax when you execute the submit command. RESOURCES: --------- command line argument tutorials: http://cplus.about.com/library/weekly/aa042902a.htm http://pardus-larus.student.utwente.nl/DOC/Lang/C/ctut/ctutorial/ argc-and-argv.html printf tutorial: http://cplus.about.com/library/weekly/aa032302a.htm How to use the GCC compiler tutorial: http://pardus-larus.student.utwente.nl/DOC/Lang/C/ctut/ctutorial/ The-compiler.html#The%20compiler GDB (GNU Debugger) tutorial http://cs.ecs.baylor.edu/~donahoo/tools/gdb/ All URL'S listed below have no white spaces.