dosexterr()              Get DOS Extended Error Values
 
 #include <dos.h>
 
 int               dosexterr(buffr);
 struct DOSERROR   *buffr;
 
    dosexterr() sets the fields of 'buffr' to the values returned by the
    MS-DOS system call 59H.  Setting buffr to the NULL pointer causes the
    function to return the value of AX, without filling in the fields of
    'buffr'.
 
    Returns:    The value in the AX register, (which is also set in the
                'exterror' field of 'buffr').
 
      Notes:    'dosexterr' is only valid for MS-DOS version 3.0 or later.
 
                The structure type DOSERROR is defined (in <dos.h> as:
 
                    struct DOSERROR {
                            int exterror;
                            char class;
                            char action;
                            char locus;
                            };
 
  -------------------------------- Example ---------------------------------
 
    The following statements try to open the file "testfile.dat". If this
    fails, and the MS-DOS version is 3.0 or later, the program prints
    extended error information.
 
            #include <dos.h>       /* for dosexterr() and struct DOSERROR */
            #include <fcntl.h>     /* for open() and O_RDWR */
            #include <stdio.h>     /* for printf() */
            #include <stdlib.h>    /* for _osmajor */
 
            struct DOSERROR   doserr;
            int fd;
 
            main()
            {
                if ((fd = open("testfile.dat", O_RDWR)) == -1) /* if error */
                    if (_osmajor >= 3) {  /* if DOS 3.0 or later... */
                        dosexterr(&doserr);
                        printf("error=%d, class=%d, action=%d, locus=%d\n",
                               doserr.exterror, doserr.class,
                               doserr.action, doserr.locus);
                 }
             }

Seealso:



This page last updated on Fri Nov 30 10:48:32 MSK 2001
Copyright © 1992-2001, Vitaly Filatov, Moscow, Russia
Webmaster