Show: Delphi C++
Display Preferences

System.SysUtils.EInOutError

From RAD Studio API Documentation
Jump to: navigation, search

System.SysUtils.ExceptionSystem.TObjectEInOutError

Delphi

EInOutError = class(Exception)

C++

class PASCALIMPLEMENTATION EInOutError : public Exception

Properties

Type Visibility Source Unit Parent
class public
System.SysUtils.pas
System.SysUtils.hpp
System.SysUtils System.SysUtils

Description

EInOutError is the exception class for file input/output errors.

EInOutError is raised when a file input/output error occurs, provided I/O checking is enabled.

Note: In Delphi code, use the $I+ directive to enable I/O checking. If an I/O error occurs while this directive is disabled, the application must call IOResult to clear the error.
Note: In C++ programs, I/O checking is a project option.

The error code is available in the ErrorCode class member. Error codes come in ranges from 0 through 99 (native OS errors). An error number greater than 100 indicates a Delphi OS error.

Error codes in the range from 0 through 99 represent OS error conditions. Refer to the OS documentation for complete error summaries. The SysErrorMessage function returns descriptive text for OS errors.

Here are some common OS I/O errors.

Number

Name

Description

100

Disk read error

Reported by Read on a typed file if you attempt to read past the end of the file.

101

Disk write error

Reported by CloseFile, Write, WriteIn, or Flush if the disk becomes full.

102

File not assigned

Reported by Reset, Rewrite, Append, Rename, or Erase if the file variable has not been assigned a name through a call to Assign or AssignFile.

103

File not open

Reported by CloseFile, Read Write, Seek, Eof, FilePos, FileSize, Flush, BlockRead, or BlockWrite if the file is not open.

104

File not open for input

Reported by Read, Readln, Eof, Eoln, SeekEof, or SeekEoln on a text file if the file is not open for input.

105

File not open for output

Reported by Write or Writeln on a text file if you do not generate a Console application.

106

Invalid numeric format

Reported by Read or Readln if a numeric value read from a text file does not conform to the proper numeric format.

Tip: When developing GUI applications and you need to provide console I/O, then you need to use the AllocConsole method in order to avoid a 105 File not open for output error. After you end your console I/O code block, call FreeConsole.

begin
  AllocConsole;
  Writeln('Console I/O is now enabled.');
  { code block }
  FreeConsole;
end;
{
  AllocConsole();
  printf("Console I/O is now enabled.\n");
  /* code block */
  FreeConsole();
}

See Also

Code Examples

Personal tools
In Other Languages
Previous Versions
Assistance