home *** CD-ROM | disk | FTP | other *** search
/ Media Share 9 / MEDIASHARE_09.ISO / pascal / tplib21.zip / INSTALL.EXE / EXCRTCL.PAS < prev    next >
Pascal/Delphi Source File  |  1993-05-30  |  1KB  |  46 lines

  1. (* Example program:  CRTCLERR unit *)
  2.  
  3. PROGRAM EXCRTCL;
  4.  
  5. USES 
  6.   CRTCLERR;
  7.  
  8. VAR
  9.   f:  TEXT;
  10.   i:  INTEGER;
  11.  
  12. BEGIN
  13.     WriteLn('EXCRTCL - CRTCLERR UNIT EXAMPLE PROGRAM');
  14.     WriteLn;
  15.     WriteLn('Turbo Pascal replaces the operating system''s critical-error');
  16.     WriteLn('handler with its own.  For this demonstration we will generate');
  17.     WriteLn('a critical error by attempting to access a diskette that is not');
  18.     WriteLn('present.  Please ensure that no diskette is in drive A, then');
  19.     WriteLn('press RETURN...');
  20.     ReadLn;
  21.     CriticalErrorTP;
  22.     Assign(f,'A:NOFILE.$$$');
  23.     WriteLn;
  24.     WriteLn('Now attempting to access drive...');
  25.     {$I-}
  26.     Reset(f);
  27.     i:=IOResult;
  28.     WriteLn('Turbo Pascal has returned an IO error of ',i);
  29.     WriteLn;
  30.     Write('Press RETURN to continue...');
  31.     ReadLn;
  32.     WriteLn;
  33.     CriticalErrorDOS;
  34.     WriteLn('With the DOS error handler restored, you will be presented');
  35.     WriteLn('with the usual "Abort, Retry, Ignore?" prompt when such an');
  36.     WriteLn('error occurs.  (Later DOS versions allow a "Fail" option.)');
  37.     WriteLn('Run this program several times and try different responses.');
  38.     Write('Press RETURN to continue...');
  39.     ReadLn;
  40.     WriteLn('Now attempting to access drive again...');
  41.     Reset(f);
  42.     i:=IOResult;
  43.     WriteLn('Turbo Pascal has returned an IO error of ',i);
  44. END.
  45.  
  46.