I have code that attempts to capture control-C's and control-breaks
and act upon them. The system continuously checks for these
(using check_for_break(), shown below); if the user hits any
other character before control-C, the handler interrupt is not called
(control-break still works OK). According to the MS-DOS encyclopedia,
anytime a control-C is in the buffer, the interrupt should be called,
as long as some function like kbhit() is called.
#define INT_VECT_CONTROL_C 0x23
#define INT_VECT_CONTROL_BRK 0x1b
void capture_key_breaks(void)
{
...
setcbrk(TRUE);
setvect(INT_VECT_CONTROL_BRK, control_c_handler);
setvect(INT_VECT_CONTROL_C, control_c_handler);
}
static int keyboard_break= 0;
void interrupt control_c_handler(void)
{
keyboard_break= 1;
}
void check_for_break(void)
{
kbhit();
if (keyboard_break) {
/* I'm trying to get to here */
}
}