Retro video games delivered to your door every month!
Click above to get retro games delivered to your door ever month!
X-Hacker.org- libc - <b>__djgpp_set_ctrl_c</b> http://www.X-Hacker.org [<<Previous Entry] [^^Up^^] [Next Entry>>] [Menu] [About The Guide]
__djgpp_set_ctrl_c
==================

Syntax
------

     #include <sys/exceptn.h>
     
     int __djgpp_set_ctrl_c(int enable);

Description
-----------

This function sets and resets the bit which controls whether `SIGINT'
(SIGINT: 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
`.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 (*Note Signal Mechanism:
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.

Return Value
------------

The previous state of the `Ctrl-C' effect: 0 if the generation of
`SIGINT' by `Ctrl-C' was disabled, 1 if it was enabled.

Example
-------


       setmode(fileno(stdin), O_BINARY);
       if (isatty(fileno(stdin)));
         __djgpp_set_ctrl_c(1);


See Also: signal

Online resources provided by: http://www.X-Hacker.org --- NG 2 HTML conversion by Dave Pearson