| www.delorie.com/djgpp/doc/libc-2.01/libc_123.html | search |
#include <sys/exceptn.h> int __djgpp_set_ctrl_c(int enable);
This function sets and resets the bit which controls whether
SIGINT (see section signal) will be raised when you press
Ctrl-C. By default Ctrl-C generates an interrupt signal
which, if uncaught by a signal handler, will abort your program.
However, when you call the setmode library function to switch the
console reads to binary mode, or open the console in binary mode for
reading, this generation of interrupt signal is turned off, because some
programs want to get the `^C' characters as any other character and
handle them by themselves.
__djgpp_set_ctrl_c lets you explicitly determine the effect of
Ctrl-C. When called with non-zero value of enable, it
arranges for Ctrl-C to generate an interrupt; if you call it with
a zero in enable, Ctrl-C are treated as normal characters.
Note that the effect of Ctrl-Break key is unaffected by this
function; use the _go32_want_ctrl_break library function to
control it.
Also note that in DJGPP, the effect of the interrupt signal will only be
seen when the program is in protected mode (See section signal,
for more details). Thus, if you press Ctrl-C while your
program calls DOS (e.g., when reading from the console), the
SIGINT signal handler will only be called after that call
returns.
The previous state of the Ctrl-C effect: 0 if the generation of
SIGINT by Ctrl-C was disabled, 1 if it was enabled.
setmode(fileno(stdin), O_BINARY);
if (isatty(fileno(stdin)));
__djgpp_set_ctrl_c(1);
Go to the first, previous, next, last section, table of contents.
| prev next webmaster | delorie software privacy |
| Copyright © 1997 | Updated Apr 1997 |