BACKWARDS FILE READING

 BBS: Inland Empire Archive
Date: 02-05-93 (08:28)             Number: 359
From: DAVID COLSTON                Refer#: NONE
  To: DAVID DUREL                   Recvd: NO  
Subj: BACKWARDS FILE READING         Conf: (2) Quik_Bas
DD>Does anyone out there have a simple routine to read an
DD>ASCII file backwards?
DD>In other words, start from the end of the file and read to the beginning,
DD>instead of the other way around.

DD>Dave
DD>--- GOMail v1.1 [DEMO] 02-04-93
The answer is yes, but you'll have to open it as a random file and then
read the bytes in reverse order.
DEF TYPE CharRecord
     Char as STRING * !
END TYPE
DIM CharFile as CharRecord
File% = FREEFILE OPEN "YOURFILE.ASC" for RANDOM AS File% LEN =
LEN(CharFile) MaxByte& = LOF(File%)
For I = MaxByte& TO 1 STEP -1
      GET#File%, I, CharFile
      PRINT CharFile.Char;
NEXT
CLOSE File%
I hope this helps.

 * OLX 2.1 TD * Death is nature's way of telling you to slow down!


--- WM v2.06/92-0178
 * Origin: Paradox of Arkansas *Wildcat 3.0* 501-646-7158 (1:3822/1)
Outer Court
Echo Basic Postings

Books at Amazon:

Back to BASIC: The History, Corruption, and Future of the Language

Hackers: Heroes of the Computer Revolution (including Tiny BASIC)

Go to: The Story of the Math Majors, Bridge Players, Engineers, Chess Wizards, Scientists and Iconoclasts who were the Hero Programmers of the Software Revolution

The Advent of the Algorithm: The Idea that Rules the World

Moths in the Machine: The Power and Perils of Programming

Mastering Visual Basic .NET