Path: utzoo!utgpu!attcan!uunet!tut.cis.ohio-state.edu!mailrus!iuvax!rutgers!cmcl2!phri!marob!daveh From: daveh@marob.masa.com (Dave Hammond) Newsgroups: comp.lang.c Subject: Re: ReadKey like Function in C Message-ID: <24E2EF0E.907@marob.masa.com> Date: 11 Aug 89 15:21:48 GMT References: <148@trigon.UUCP> <207600029@s.cs.uiuc.edu> <941@lakesys.UUCP> Reply-To: daveh@marob.masa.com (Dave Hammond) Organization: ESCC, New York City Lines: 21 In article <941@lakesys.UUCP> davef@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 >> [...] >Absolutely! You need only do the following: > >1. do an "ioctl (n, TCGETA, &term) >2. modify some parameters, such as > term.c_lflag &= ~(ICANON | ECHO) or whatever else you need >3. term.c_cc [VTIME] = some_value <- for timeout, if desired >4. term.c_cc [VMIN] = 1 <- satisfy read with 1 character >5. ioctl (m, TCSETA, &term) to reset the terminal >6. you can now do a read (n, &work, 10) True enough -- on ONE of the dozens of systems on which C compilers exist. Remember, the name of this newsgroup is NOT comp.lang.c.on.unix.system.v ! -- Dave Hammond daveh@marob.masa.com