home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Black Box 4
/
BlackBox.cdr
/
progc
/
itcjun90.arj
/
TSTCEH.C
< prev
next >
Wrap
C/C++ Source or Header
|
1991-09-07
|
1KB
|
51 lines
/************************************************
* TESTCEH.C - Critical Error Handling test *
* *
* 900424 MCMason - updated for Turbo C v2.0 *
* 8911?? RHShaw - originally written *
************************************************/
#include <stdio.h>
#include <dos.h>
#include <stdarg.h>
#include <stdlib.h>
#include <conio.h>
#include <ctype.h>
#include <string.h>
#if !defined(TRUE)
#define TRUE (1==1)
#define FALSE (!TRUE)
#endif
char workbuf[100];
int CriticalErrorHandler(int, int, int, int);
void main(void)
{
FILE *fp;
printf("Installing Critical Error Handler\n");
harderr(CriticalErrorHandler);
/* Show a diskette failure */
puts("Test disk error handling ..."
" open drive door A, and press ENTER");
gets(workbuf);
if ((fp=fopen("a:newfile.txt","r"))==NULL)
printf("Can't open file for reading\n");
else
fclose(fp);
/* Show failure on LPT1 */
puts("\n\n\n\n\nTest character device error "
"handling, take printer off line, and "
"press ENTER");
fputs("Critical Error Handler test\n\r",stdprn);
fflush(stdprn);
printf("Exiting...\n\r");
exit(0);
}