TURBO C: signal(SIGINT, ) works only for 1 Ctrl-Break?
marwk at levels.sait.edu.au
marwk at levels.sait.edu.au
Tue Jan 1 04:51:17 AEST 1991
In the TURBO C 2.0 reference manual on page 346 thre is an example of using
signal() to divert the CTRL-BREAK exception to a user-defined routine.
I entered the following code and it works the first time that ^Break is
pressed, but then the program aborts the next time I press ^Break again.
Does the signal get used up each time it is used?
#include <stdio.h>
#include <signal.h>
#include <conio.h>
void gotcha(int sig)
{
printf("Ctrl-Break has been disabled - Press any key to continue\n");
fflush(stdin);
getch();
}
void main(void)
{
signal(SIGINT, gotcha);
printf("OK, go on, just you try to interrupt me!\n");
while (1)
printf("a");
}
Thank you.
Ray
More information about the Comp.lang.c
mailing list