Path: utzoo!attcan!utgpu!jarvis.csri.toronto.edu!rutgers!cs.utexas.edu!uunet!portal!cup.portal.com!Tim_CDC_Roberts From: Tim_CDC_Roberts@cup.portal.com Newsgroups: comp.lang.c Subject: Re: ReadKey like Function in C Message-ID: <21175@cup.portal.com> Date: 10 Aug 89 17:47:23 GMT References: <148@trigon.UUCP> <207600029@s.cs.uiuc.edu> <941@lakesys.UUCP> Distribution: usa Organization: The Portal System (TM) Lines: 27 In article <941@lakesys.UUCP>, Dave Fenske writes: >In article <207600029@s.cs.uiuc.edu> mccaugh@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 theon char-input, then switching back when > > done? > >Absolutely! You need only do the following: > >1. do an "ioctl (n, TCGETA, &term) > (remainder deleted) Ah, but this is not a C solution, K&R or otherwise. It is a UNIX solution. Definitively, once again: THERE IS NO STANDARD, O.S.-TRANSPARENT METHOD OF READING A SINGLE KEYSTROKE WITHOUT A CR. Never has been, never will be. If the original questioner rephrases to: "How can I do a ReadKey in Microsoft C 5.0 on MS-DOS", THEN there is an answer. However, the question "How can I do a ReadKey in C?" has no correct unqualified answer. Tim_CDC_Roberts@cup.portal.com | Control Data... ...!sun!portal!cup.portal.com!tim_cdc_roberts | ...or it will control you.