RAD Studio VCL Reference
|
EInOutError is the exception class for file input/output errors.
EInOutError = class(Exception);
class EInOutError : public Exception;
EInOutError is raised when an file input/output error occurs, provided I/O checking is enabled.
Error codes in the range 0-99 represent OS error conditions, which are different for Windows and Linux. 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, arranged by rough equivalents in Linux and Windows:
LinuxWindows
Linux |
|
Windows |
|
Error Code |
Description |
Error Code |
Description |
2 |
No such file or directory |
2 |
File not found |
3 |
Path not found |
|
|
5 |
I/O Error |
|
|
13 |
Permission denied |
5 |
Access denied |
20 |
Not a directory |
|
|
21 |
Is a directory |
|
|
32 |
Sharing violation |
|
|
Error codes in the range 100 to 149 represent error conditions raised by CLX. Here are the CLX I/O error codes: |
|
|
|
Delphi Examples:
{ Click the button to open a TOpenDialog, then select a file to delete. } procedure TForm1.Button1Click(Sender: TObject); var F: Textfile; begin OpenDialog1.Title := 'Delete File'; if OpenDialog1.Execute then begin AssignFile(F, OpenDialog1.FileName); try Reset(F); if MessageDlg('Erase ' + OpenDialog1.FileName + '?', mtConfirmation, [mbYes, mbNo], 0) = mrYes then begin CloseFile(F); Erase(F); end; except on EInOutError do MessageDlg('File I/O error.', mtError, [mbOk], 0); end; end; end;
Copyright(C) 2009 Embarcadero Technologies, Inc. All Rights Reserved.
|
What do you think about this topic? Send feedback!
|