Mega Code Archive

 
Categories / Delphi / Examples
 

Errcodes

I/O ERROR CODES Richard Nov '98 function TPageForm.GetError (const ErrorCode: integer): String; {returns a string pertaining to the type of error. If IO-checking was off we could check for errors by looking at IOResult, but in this program we use an exception handler (in the file reading routine above) instead. The strings listed below are taken from the Delphi Help system...} begin case ErrorCode of 2: Result := 'File not found'; 3: Result := 'Path not found'; 4: Result := 'Too many open files'; 5: Result := 'File access denied'; 6: Result := 'Invalid file handle'; 12: Result := 'Invalid file access code'; 15: Result := 'Invalid drive'; {next line may be useful to track program errors...} {87: Result := 'Invalid program parameter';} 00: Result := 'Disk read error'; 101: Result := 'Disk write error'; 102: Result := 'File not assigned'; 103: Result := 'File not open'; {next three messages I/O errors couldn't happen in this context...} 104: Result := 'File not open for input'; 105: Result := 'File not open for output'; 106: Result := 'Invalid numeric format'; else Result := '' end end;