barsam@music.ame.arizona.edu (Barsam Marasli) (05/20/88)
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. --------------------------------------------------------------- Barsam Marasli Internet: eros!barsam@arizona.edu UUCP : ...{allegra,ihnp4,cmcl2,hao!noao}!arizona!eros!barsam Bitnet : barsam@arizrvax
eap@bu-cs.BU.EDU (Eric Pearce) (05/20/88)
In article <660@amethyst.ma.arizona.edu> eros!barsam@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@bu-it.bu.edu CSNET eap%bu-it@bu-cs JNET jnet%"ep@buenga" * Hanging out in the Q Continuum * BITNET iteap@buacca