Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!mailrus!cornell!calvin!richard From: richard@calvin.EE.CORNELL.EDU (Richard Brittain) Newsgroups: comp.lang.c Subject: Re: ReadKey like Function in C Message-ID: <1255@calvin.EE.CORNELL.EDU> Date: 22 Aug 89 07:08:25 GMT References: <148@trigon.UUCP> <225800206@uxe.cso.uiuc.edu> <19095@mimsy.UUCP> <17228@ut-emx.UUCP> <13653@bloom-beacon.MIT.EDU> Reply-To: richard@calvin.spp.cornell.edu (Richard Brittain) Organization: Cornell Space Plasma Physics Group Lines: 27 In article <13653@bloom-beacon.MIT.EDU> scs@adam.pika.mit.edu (Steve Summit) writes: >I don't know why control-C's are polled under DOS; the low-level >keyboard scan codes do come in as true interrupts, so a proper, >asynchronous control-C interrupt could have been generated. > Actually, control-break generates a very low-level asynchronous interrupt which will get out of most problems, but the default handler for this interrupt just empties the keyboard buffer and sticks a ^C in there, because it doesn't know if it is "safe" to terminate the program. I suspect if you installed your own control-break handler you could break out of many of these wonderful little 1-liners that lock up our pc's , but it probably would introduce it's own problems. My own 2 cents on the question of standardising single character unbuffered i/o: It seems to me that what is needed is not only a reliable way to perform single character keyboard reads, but also an easy way to detect function key use. I know that you can do this if you have curses/terminfo AND you are prepared to meet miscellaneous operating system gremlims face to face. Unix has a reputation for being user hostile, and isn't this perhaps because writing a nice user interface without standardised, portable routines is such a pain that hardly anyone bothers to even attempt it. Richard Brittain, School of Elect. Eng., Upson Hall Cornell University, Ithaca, NY 14853 ARPA: richard@calvin.spp.cornell.edu UUCP: {uunet,uw-beaver,rochester,cmcl2}!cornell!calvin!richard