[<<Previous Entry]
[^^Up^^]
[Next Entry>>]
[Menu]
[About The Guide]
IOResult Returns I/O Error Status
IOResult : Integer; [TP]
Returns the input/output (I/O) error status. To use this, you must
first disable automatic I/O error checking using the {$I-} compiler
directive. Having done that, you should reference the value of
IOResult after each I/O operation. If IOResult returns 0, the I/O
operation was successful. Any other value returned by IOResult means
an error occurred. If an I/O error occurs and IOResult is not called,
all I/O is suspended until IOResult is called.
Notes: After IOResult is called, any new calls to IOResult
return 0 until the next I/O operation is performed.
See 'I/O Errors' for a list of I/O Errors.
-------------------------------- Example ---------------------------------
{ The following procedure performs crash-proof integer input }
type
MsgStr = string[80];
...
procedure GetInteger(var I : Integer; Msg : MsgStr; Low,High :
Integer);
begin {$I-} { disable I/O error checking }
I := Low - 1;
repeat
Write(Msg);
Readln(I);
until (IOResult = 0) and (Low <= I) and (I <= High)
end; {$I+} { enable I/O error checking }
GetInteger(I,'Enter a number from 1 to 10: ',1,10);
See Also:
I/O errors
$I±
This page created by ng2html v1.05, the Norton guide to HTML conversion utility.
Written by Dave Pearson