[Overview][Constants][Types][Classes][Procedures and functions][Variables][Index] Reference for unit 'System' (#rtl)

IOResult

Return result of last file IO operation

Declaration

Source position: systemh.inc line 1409

function IOResult: Word;

Description

IOresult contains the result of any input/output call, when the {\$i-} compiler directive is active, disabling IO checking. When the flag is read, it is reset to zero. If IOresult is zero, the operation completed successfully. If non-zero, an error occurred. The following errors can occur:

dos errors :

2
File not found.
3
Path not found.
4
Too many open files.
5
Access denied.
6
Invalid file handle.
12
Invalid file-access mode.
15
Invalid disk number.
16
Cannot remove current directory.
17
Cannot rename across volumes.

I/O errors :

100
Error when reading from disk.
101
Error when writing to disk.
102
File not assigned.
103
File not open.
104
File not opened for input.
105
File not opened for output.
106
Invalid number.

Fatal errors :

150
Disk is write protected.
151
Unknown device.
152
Drive not ready.
153
Unknown command.
154
CRC check failed.
155
Invalid drive specified..
156
Seek error on disk.
157
Invalid media type.
158
Sector not found.
159
Printer out of paper.
160
Error when writing to device.
161
Error when reading from device.
162
Hardware failure.

Errors

None.

Example

Program Example35;

{ Program to demonstrate the IOResult function. }

Var F : text;

begin
  Assign (f,paramstr(1));
  {$i-}
  Reset (f);
  {$i+}
  If IOresult<>0 then
    writeln ('File ',paramstr(1),' doesn''t exist')
  else
    writeln ('File ',paramstr(1),' exists');
end.

Documentation generated on: May 14 2021