home *** CD-ROM | disk | FTP | other *** search
/ RBBS in a Box Volume 1 #2 / RBBS_vol1_no2.iso / 014r / reverse.zip / REVERSE.DOC
Text File  |  1988-10-01  |  1KB  |  22 lines

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