home *** CD-ROM | disk | FTP | other *** search
/ RBBS in a Box Volume 1 #2 / RBBS_vol1_no2.iso / 014r / push_pop.zip / POP.PAS next >
Pascal/Delphi Source File  |  1985-06-29  |  838b  |  37 lines

  1. { POP.PAS
  2.   By Bela Lubkin 71016,1573
  3.   Compile this to a .COM file and put POP.COM somewhere on your PATH.  Then
  4.   POP will return you to a directory path saved with the PUSH command.
  5.   Requires Turbo 3.0 or greater, DOS 2.0 or greater.
  6. }
  7.  
  8. Const
  9.   StackFileName='C:\CDSTACK.DAT';  { Change to whatever seems appropriate }
  10.  
  11. Type
  12.   StackElement=String[66];
  13.  
  14. Var
  15.   S: StackElement;
  16.   StackFile: File Of StackElement;
  17.   I: Integer;
  18.  
  19. Begin
  20.   Assign(StackFile,StackFileName);
  21.   {$I-} Reset(StackFile); {$I+}
  22.   If IOResult<>0 Then
  23.    Begin
  24.     WriteLn('Stack empty');
  25.     Halt;
  26.    End;
  27.   Seek(StackFile,FileSize(StackFile)-1);
  28.   Read(StackFile,S);
  29.   Seek(StackFile,FileSize(StackFile)-1);
  30.   Truncate(StackFile);
  31.   I:=FileSize(StackFile);
  32.   Close(StackFile);
  33.   If I=0 Then Erase(StackFile);
  34.   ChDir(S);
  35. End.
  36.  
  37.