help needed with signal(2)
Eric Pearce
eap at bu-cs.BU.EDU
Sat May 21 00:27:01 AEST 1988
In article <660 at amethyst.ma.arizona.edu> eros!barsam at arizona.edu says:
>I have a C program that runs continuously. I would like
>to get its attention by hitting the <return> key. I can do
>it using signal(2) with SIGINT or SIGQUIT but I don't want
>to use interrupt or quit, and I couldn't figure out how to
>do it with <return>. Any help (preferably with e-mail) would
>be greatly appreciated.
If you are using BSD, why don't you use this instead:
#include <sys/ioctl.h>
int count;
for (;;) { /* endless loop */
ioctl(0,FIONREAD,&count);
if (count) {
/* key was pressed */
}
else {
/* nothing happened */
}
}
--
-------------------------------------------------------------------------------
UUCP !harvard!bu-cs!bu-it!eap ARPANET eap at bu-it.bu.edu CSNET eap%bu-it at bu-cs
JNET jnet%"ep at buenga" * Hanging out in the Q Continuum * BITNET iteap at buacca
More information about the Comp.unix.questions
mailing list