ReadKey like Function in C

Chris Torek chris at mimsy.UUCP
Thu Aug 10 10:23:24 AEST 1989


In article <207600029 at s.cs.uiuc.edu> mccaugh at s.cs.uiuc.edu writes:
>Wait a minute -- am I missing something here? Isn't conventional (Kernighan-
>Ritchie) C supoosed to be capable of system-calls to the operating-system, 
>say, to switch I/O-mode from cooked to raw, thereby obviating the <CR> on
>char-input, then switching back when done?

Assuming you have an operating system, and assuming it provides such a
capability, yes.  (As I mentioned, some Univac and IBM systems [on
which C compilers do sometimes exist] think they are talking to card
reader/punches and line printers, even if there is a graphics display
terminal at the end of the virtual card punch.  One winds up inventing
horrible and baroque protocols so as to be able to interact with such
machines.)

At any rate, if the system exists and is capable, the question has
changed.  No longer is it `how do I read a single key in C':  It has
become `how do I make a system call from C to enable single key
operation, or obtain a single keystroke, using FooBletchOS Version
91523.158.1.6.23.9.4-and-a-half'.  And that question does not belong
in a C newsgroup (or mailing list, for those without netnoise).

(Incidentally, this is one of those things that seems to change
with every variation of the system.  Pick any two Unix machines;
they probably do it differently.  Even different releases of VMS
do it differently.)
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at mimsy.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list