home *** CD-ROM | disk | FTP | other *** search
/ RBBS in a Box Volume 1 #2 / RBBS_vol1_no2.iso / 014r / push_pop.zip / PUSH.PAS < prev   
Pascal/Delphi Source File  |  1985-06-29  |  922b  |  39 lines

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