Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Microsoft C 6.0 - <b>dosexterr() get extended error codes</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
 dosexterr()             Get extended error codes

 #include   <dos.h>

  int dosexterr(buffer);
           struct DOSERROR {
              int exterror;        AX register contents
              char class;          BH register contents
              char action;         BL register contents
              char locus;          CH register contents
              } *buffer;

    dosexterr() uses MS-DOS function 59h to obtain additional information
    about errors that have occurred in MS-DOS function requests. When
    invoked immediately after an error condition it returns four pieces
    of information: an error code, an error class that tells more about
    the type of error, a recommended action, and a locus that suggests
    the part of the system that caused the error.

    Returns:    The value in the AX register, which is the same as the
                value in the exterror structure field.

      Notes:    If dosexterr() is called using a NULL pointer, the AX
                value is still returned but the structure members are
                left empty.

                struct DOSERROR is defined in dos.h.

                dosexterr() primarily uses MS-DOS 3.0 or higher extended
                error capabilities, but it also returns information about
                MS-DOS 2.0 or higher functions that set the carry flag on
                errors.

                See MS-DOS Error Codes under Tables for specific meaning
                of returned values.

   Portability:     MS-DOS only, version 3.0 or higher

------------------------------- Example ---------------------------------

 This program reports extended error information if file data.txt
 cannot be opened.

           #include <dos.h>
           #include <fcntrl.h>
           #include <stdio.h>

           struct DOSERROR ext_error;
           int file_handle;

           main()
           {
                if ((file_handle = open("data.txt", O_RDONLY)) == -1)
                   {
                   dosexterr( &ext_error );
                   printf("error = %d;  class = %d;  action = %d;  locus =
           %d\n",
                           ext_error.exterror, ext_error.class,
                           ext_error.action, ext_error.locus);
                   }

                . . . read file . . .
                . . . close file . . .

           }


See Also: _dos_allocmem() _dos_setblock() _dos_freemem()

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson