Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!usc!zaphod.mps.ohio-state.edu!uakari.primate.wisc.edu!aplcen!haven!adm!smoke!gwyn From: gwyn@smoke.BRL.MIL (Doug Gwyn) Newsgroups: comp.sys.apple2 Subject: Re: Keyin from C Keywords: C Key Message-ID: <13075@smoke.BRL.MIL> Date: 7 Jun 90 19:27:15 GMT References: <1422@oucsace.cs.OHIOU.EDU> Organization: U.S. Army Ballistic Research Laboratory, APG, MD. Lines: 20 In article <1422@oucsace.cs.OHIOU.EDU> bchurch@oucsace.cs.OHIOU.EDU (Bob Church) writes: >I am trying to read a key from the keyboard in C. I want to be able >to read a single key such as a cursor without pressing return. I put >together a short function which directly accesses STROBE and KBD. This >works but is obviously machine dependent. Is there a "true C" way of >doing this? All of the C functions seem to depend upon return being >pressed. There is no portable facility for this in C. Some systems do not even provide ANY way to accomplish a keyin() function. Those that do, use different methods to accomplish it. Your best bet is to design an interface that can be implemented in most environments and have your application use that interface; the implementation of the interface will have to be done for each different system time to which you port your applications. For example, extern void rawmode(); /* enter single-key input mode */ extern void cookedmode(); /* resume line-at-a-time mode */ extern int getkey(); /* return next available character */