ReadKey like Function in C

Richard Brittain richard at calvin.EE.CORNELL.EDU
Tue Aug 22 17:08:25 AEST 1989


In article <13653 at bloom-beacon.MIT.EDU> scs at 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 at calvin.spp.cornell.edu	
UUCP: {uunet,uw-beaver,rochester,cmcl2}!cornell!calvin!richard



More information about the Comp.lang.c mailing list