home *** CD-ROM | disk | FTP | other *** search
- { ╔═══╦══════════════════════════════════════════════╦═══╗
- ║ ║ Pascal Library by Scott Wade ║ ║
- ║ ║ 715 FM 1959 Apt 310 ║ ║
- ║ ║ Houston, TX 77034 ║ ║
- ┌──────╨───╨──────────────────────────────────────────────╨───╨──────┐
- │ This group of routines is contributed to public domain, and no │
- │ one can possibly get any commercial value out of them since they │
- │ must be used in other programs. I require that if these are used │
- │ as is in any program, that this banner remain with the source │
- │ code of the program. I would appreciate any comments or sugges- │
- │ tions on improvements, & am curious to hear how these are used. │
- │ You can leave a message for me on these BBS's: │
- │ Ziggy's 821-1391 ScoreBoard 583-7848 │
- │ TBL-COMM 661-9040 Test-Mode 660-9252 │
- └────────────────────────────────────────────────────────────────────┘
- v1.1 vIOErr.TST test the IOErr message generator library.
- Sep/27/85 added v1.1 : documentation cleaned up some.}
-
- Type
- Buffer = string[ 255 ];
-
- const
- IOErrVal : Integer = 0;
- IOErr : Boolean = False;
- TrapErr : Boolean = False;
-
- var
- InFile : Text;
- IOErrMsg : Buffer ;
- DummyStr : Buffer ;
-
- {$I vIOErr.LIB}
-
- procedure PutLineNum(LineNum : Integer);
- { This routine tells you which line is being executed, so that you can
- see which statement is causing which error.
- }
- begin
- GotoXY(1,10);
- ClrEol; writeln('Test of vIOErr.LIB v1.1 Press a key to continue. ');
- ClrEol; Writeln('Executing line #',LineNum);
- ClrEol; writeln('MSG> ',IOErrMsg,'<');
- ClrEol; writeln('IOErr is ',IOErr);
- ClrEol; writeln('IOErrVal is ',IOErrVal:3);
- IOErrMsg := '';
- end{ PutLineNum };
-
- begin{ MAIN }
- IOErr := False ;
- IOErrVal := 0;
- IOErrMsg := '';
-
- {$I-}
- { assign a dummy file..this should work ok. }
- Assign(InFile,'dummy');
- vIOerr( IOErrMsg, IOErrVal, IOErr );
- PutLineNum(1); Repeat Until Keypressed;
-
- { write to the file..this should also work ok }
- Rewrite(InFile);
- vIOerr( IOErrMsg, IOErrVal, IOErr );
- PutLineNum(2); Repeat Until Keypressed;
-
- { Attempt to read from file assigned for write..this should error }
- PutLineNum(3); Read(Infile,DummyStr);
- vIOerr( IOErrMsg, IOErrVal, IOErr );
- PutLineNum(3); Repeat Until Keypressed;
-
- { close file..this should work ok }
- Close(Infile);
- vIOerr( IOErrMsg, IOErrVal, IOErr );
- PutLineNum(4);
-
- { attempt to read from a file that isnt open...this should error }
- PutLineNum(5); Read(Infile,DummyStr);
- vIOerr( IOErrMsg, IOErrVal, IOErr );
- { test of the function that prints the error message for you. }
- Traperr := vTrueIferr( IOErrVal, IOErrMsg );
- If TrapErr then writeln( 'Error Trapped.');
-
- {$I+}
- end.{ vIOErr.TST
- *****************************************************************************}