Xref: utzoo comp.lang.c:15290 comp.unix.wizards:13926 Path: utzoo!utgpu!attcan!uunet!ficc!peter From: peter@ficc.uu.net (Peter da Silva) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: printf, data presentation Summary: Inkey leads to poor programming. It's inherently expensive to poll or busy-wait. Keywords: printf, terminals, fixed format screens Message-ID: <2655@ficc.uu.net> Date: 6 Jan 89 22:25:11 GMT References: <19@xenlink.UUCP> <731@picuxa.UUCP> <8332@ihlpl.ATT.COM> Organization: Xenix Support Lines: 25 From my recollection of BASIC, INKEY$ has two main uses: (1) Enabling a clean abort of a running compute-bound program. (2) Busy-waiting for a time-interval. For case 1, UNIX provides signal handlers. For case 2, a read-with-timeout is more useful. Luckily, UNIX provides this as well. For long timeouts, it reduces to the case of a signal handler. For short timeouts, you need the USG termio, and set VMIN and VTIME. (3) Terminal emulators. For this case, you're better off with a multiway wait or two cooperating processes. Using an inkey$ type call to do this will just get you a bad name as a system hog. We just had to rip code like this out of microEmacs last year some time. -- Peter da Silva, Xenix Support, Ferranti International Controls Corporation. Work: uunet.uu.net!ficc!peter, peter@ficc.uu.net, +1 713 274 5180. `-_-' Home: bigtex!texbell!sugar!peter, peter@sugar.uu.net. 'U` Opinions may not represent the policies of FICC or the Xenix Support group.