home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
C!T ROM 2
/
ctrom_ii_b.zip
/
ctrom_ii_b
/
PROGRAM
/
PASCAL
/
PAS_0593
/
TESTRB.PAS
< prev
next >
Wrap
Pascal/Delphi Source File
|
1993-05-30
|
903b
|
45 lines
{
Demonstration program for RB.PAS.
Takes one command line parameter, the name of a text file to read backwards.
Reads file one line at a time backwards and writes the result to StdOut.
See RB.PAS for further details.
Written 6/7/88, Kim Kokkonen, TurboPower Software.
Released to the public domain.
}
program Test;
{-Demonstrate RB unit}
uses
RB;
var
F : BackText;
S : string;
procedure CheckError(Result : Word);
begin
if Result <> 0 then begin
WriteLn('RB error ', Result);
Halt;
end;
end;
begin
if ParamCount = 0 then
AssignBack(F, 'RB.PAS')
else
AssignBack(F, ParamStr(1));
CheckError(BackResult);
ResetBack(F, 1024);
CheckError(BackResult);
while not BoF(F) do begin
ReadLnBack(F, S);
CheckError(BackResult);
WriteLn(S);
end;
CloseBack(F);
CheckError(BackResult);
end.