Xref: utzoo comp.lang.c:15231 comp.unix.wizards:13879 Path: utzoo!attcan!uunet!lll-winken!lll-ncis!helios.ee.lbl.gov!pasteur!ucbvax!decwrl!labrea!rutgers!cmcl2!phri!marob!daveh From: daveh@marob.MASA.COM (Dave Hammond) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: printf, data presentation Keywords: printf, terminals, fixed format screens Message-ID: <444@marob.MASA.COM> Date: 5 Jan 89 14:00:20 GMT References: <19@xenlink.UUCP> <731@picuxa.UUCP> <8332@ihlpl.ATT.COM> Reply-To: daveh@marob.masa.com (Dave Hammond) Organization: ESCC New York City Lines: 22 In article <8332@ihlpl.ATT.COM> knudsen@ihlpl.ATT.COM (Knudsen) writes: >Speaking of libraries and interactive screen programs, >it strikes me as criminal negligence that hardly any C standard >libs include the inkey() function, which means "check whether >a char has been typed on the keyboard; if so, return it; >else return \0 (or whatever). DO NOT BLOCK." If I understand your need, the fcntl VMIN and VTIM parameters may help. If you set VMIN=0 and VTIM>0, read() returns immediately if characters are available, or in VTIM 10th-secs if the queue is dry. I use VMIN=0,VTIM=1 to grab the next char, or return immediately if none is available. >Even a blocking version (that would return a char once typed, >without waiting for a newline) would be useful. Try reading with VMIN=1,VTIM=0. This is akin to the Berkeley CBREAK mode. -- Dave Hammond ...!uunet!masa.com!{marob,dsix2}!daveh