Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- Zortech C++ 3.0r4 - <b>critical error handling</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
Critical Error Handling

   Critical errors can occur under MS-DOS during attempts to access floppy
   disk drives or while using a parallel printer. They can cause the Abort,
   Retry, Ignore, Fail message to appear across your beautiful windowed
   environment at the most inopportune moments. Normally you have to
   write and debug a critical error handler for MS-DOS, and for each DOS
   extended platform you want to support.

   The cerror_ functions provide a solution to this problem. They are
   portable across all the platforms that Zortech supports. This code will work
   under DOS, Rational Systems DOS16RM, Phar Lap s DOS386 and our
   own 286 and 386 DOS extended platforms. They also work under OS/2 and
   UNIX.

   These functions utilize the following global variable:

       int (* _far _cdecl _cerror_handler)(int *ax,int *di);

   To use them, install a pointer to your handler in  _cerror_handler, and
   then call cerror_open() to activate it.

Example 

   int _far _cdecl myhandler(int *ax,int *di)
   {
       // display critical error message
       // and set *ax to user response
       // don't call any functions that could call DOS
       // because this is and interrupt service routine
       // and DOS is not reentrant
   }

   void main(void)

   {
       // notify your custom handler
       _cerror_handler = myhandler;

       // install critical error handler
      cerror_open();

       // remove critical error handler
       cerror_close();
   }





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