www.digitalmars.com Home | Search | CTG | RTL | IDDE | STL | C/C++ Compiler | D
Last update Thu Apr 13 20:39:46 2006
Runtime Library
Reference


· Constants
· Data types

Standard C
· assert.h
· complex.h
· ctype.h
· fenv.h
· float.h
· locale.h
· math.h
· setjmp.h
· signal.h
· stdarg.h
· stddef.h
· stdio.h
· stdlib.h
· string.h
· time.h


Standard C++
· IOstream
· new


Win32
· gc.h


DOS, DOS32, Win16
· bios.h
· cerror.h
· disp.h
· dos.h
· dos.h part 2
· emm.h
· handle.h
· int.h
· msmouse.h
· sound.h
· swap.h
· tsr.h
· winio.h


Other C
· bitops.h
· conio.h
· controlc.h
· direct.h
· fltpnt.h
· io.h
· page.h
· process.h
· search.h
· sys\stat.h
· tabsize.h
· trace.h
· utime.h
· unmangle.h
· util.h


Other C++
· regexp.h
· class complex


cerror,h


cerror_close

Header
cerror.h
Prototype
void __cdecl cerror_close(void);
Description
Removes a user supplied critical handler. The handler should have previously been installed by cerror_open().
Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
cerror_open
Example
See cerror_open

cerror_open

Header
cerror.h
Prototype
void __cdecl cerror_open(void);
Description
Installs a user supplied critical handler. This function, which you must write, uses the following prototype:

void __cdecl _cerror_handler(unsigned short *ax, unsigned short *di);

After a call to cerror_open, this routine begins receiving critical errors. It stops receiving them with a call to cerror_close.

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 messages. 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_open and cerror_close functions provide a solution to this problem. They are portable across all platforms Digital Mars C++ supports.

Compatibility
DOS Windows 3.x Phar Lap DOSX Win32
See Also
cerror_close
Example
/* 	Example for cerror_open 
	Also demonstrates cerror_close 
*/ 

#include <cerror.h> 
#include <stdio.h> 
#include <windows.h>

static unsigned short ax_value, di_value; 

void _cerror_handler (unsigned short *ax, 
		       unsigned short *di) 
{   
  ax_value = *ax; 
  di_value = *di; 
} 

void main () 
{   
  printf (" Be sure there is no disk in A:\n"); 
  getch (); 
  cerror_open (); 

  ax_value = di_value = 0; 
  fopen ("a:anything", "r"); 
  printf ("After trying to open A:ANYTHING, ax = %x, di = %x\n",
	ax_value, di_value); 

  ax_value = di_value = 0;
  fopen ("c:anything", "r"); 
  printf ("After trying to open C:ANYTHING, ax = %x, di = %x\n",
	ax_value, di_value);

  cerror_close (); 
}
Output
Be sure there is no disk in A:
After trying to open A:ANYTHING, ax = 1a00, di = 2
After trying to open C:ANYTHING, ax = 0, di = 0