C Language and Libraries Help (clang.hlp) (
Table of Contents;
Topic list)
Important Notice
The pages on this site contain documentation for very old MS-DOS software,
purely for historical purposes.
If you're looking for up-to-date documentation, particularly for programming,
you should not rely on the information found here, as it will be woefully
out of date.
EXTERR.C
◄Up► ◄Contents► ◄Index► ◄Back►
─────Run-Time Library───────────────────────────────────────────────────────
/* EXTERR.C illustrates function:
* _dosexterr (DOS-only)
*/
#include <dos.h>
#include <fcntl.h>
#include <stdio.h>
#include <stdlib.h>
void errorinfo( void ); /* Prototype */
void main( int argc, char *argv[] )
{
int hsource;
/* Open to get file handle and test for errors. Try specifying
* invalid files to show different errors.
*/
if( _dos_open( argv[1], _O_RDWR, &hsource ) )
errorinfo();
printf( "No error\n" );
_dos_close( hsource );
exit( 0 );
}
/* Displays an extended error message. */
void errorinfo()
{
struct _DOSERROR err;
static char *eclass[] =
{
"", "Out of Resource", "Temporary Situation", "Authorization",
"Internal", "Hardware Failure", "System Failure",
"Application Error", "Not Found", "Bad Format", "Locked",
"Media", "Already Exists", "Unknown"
};
static char *eaction[] =
{
"", "Retry", "Delay Retry", "User", "Abort", "Immediate Exit",
"Ignore", "Retry After User Intervention"
};
static char *elocus[] =
{
"", "Unknown", "Block Device", "Net", "Serial Device", "Memory"
};
/* Get error information and display class, action, and locus. */
_dosexterr( &err );
printf( "Class:\t%s\nAction:\t%s\nLocus:\t%s\nAction\t",
eclass[err.errclass], eaction[err.action], elocus[err.locus] );
/* Errors that could be caused by sample _dos_open. You can expand
* this list to handle others.
*/
switch( err.exterror )
{
case 2:
printf( "File not found\n" );
break;
case 3:
printf( "Path not found\n" );
break;
case 5:
printf( "Access denied\n" );
break;
}
exit( err.exterror );
}
-♦-