Path: utzoo!utgpu!attcan!uunet!tut.cis.ohio-state.edu!ucbvax!hplabs!hpl-opus!hpnmdla!hpmwtd!jeffa From: jeffa@hpmwtd.HP.COM (Jeff Aguilera) Newsgroups: comp.lang.c Subject: Re: ReadKey like Function in C Message-ID: <680007@hpmwjaa.HP.COM> Date: 11 Aug 89 17:12:53 GMT References: <148@trigon.UUCP> Organization: HP Microwave Tech. - Santa Rosa, Ca. Lines: 13 > 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) Close. If a timeout is specified, set term.c_cc[VMIN] = 0. Otherwise the timer is not started until receipt of the first character; i.e., the program can still wait forever.