home *** CD-ROM | disk | FTP | other *** search
- REVERSE reverses a text file line-by-line. The new file contains
- every line in the original file, but in reverse order. It works
- by building a table in memory of the seek position of the start of
- each line in the source file. This does not require the original
- file to be held in memory, so large files can be reversed.
-
- In the second pass, the table is read backwards, and each line is
- picked up at its recorded seek position, read in, and written to
- the target file.
-
- The source and target files must not be the same file! No check is
- made for this condition, but any other irregular parameters are
- reported and usage instructions are given.
-
- Note the use of the TRACEx macros. I include these in all my C
- programs from the start. That way, I can trace the execution of
- a program at any time just be compiling it with the -DDEBUG flag
- on the command line. Recompiling without that flag removes the
- traces from the object code, without having to remove the trace
- statements from the source code. That way they're still there next
- time you change the program, in case you need to trace it again.
-