home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The Devil's Doorknob BBS Capture (1996-2003)
/
devilsdoorknobbbscapture1996-2003.iso
/
Dloads
/
OTHERUTI
/
MASTER-1.ZIP
/
SOURCE
/
CHAP06
/
CHAP06.LZH
/
CTRLBRK.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1992-07-17
|
539b
|
23 lines
// ctrlbrk.cpp
// Shows how to intercept a Ctrl-Break to avoid
// terminating a program. Will not work if launched
// from the IDE! Execute from command line to
// see it in operation.
#include <stdio.h>
#include <conio.h>
#include <dos.h>
int IgnoreCtrlBrk(void)
// Return 0 to abort program; non-0 to continue
{ return 1; }
void main(void)
{
ctrlbrk( IgnoreCtrlBrk );
while (1) {
printf("Press <space> to halt; Ctrl-Break is intercepted...");
if (kbhit())
{ if (getch()==' ') return; }
};
}