Xref: utzoo comp.lang.c:15319 comp.unix.wizards:13962 Path: utzoo!attcan!uunet!lll-winken!ames!mailrus!ukma!uflorida!novavax!twwells!bill From: bill@twwells.uucp (T. William Wells) Newsgroups: comp.lang.c,comp.unix.wizards Subject: Re: printf, data presentation Keywords: printf, terminals, fixed format screens Message-ID: <299@twwells.uucp> Date: 8 Jan 89 00:11:59 GMT References: <19@xenlink.UUCP> <731@picuxa.UUCP> <8332@ihlpl.ATT.COM> <915@husc6.harvard.edu> Reply-To: bill@twwells.UUCP (T. William Wells) Organization: None, Ft. Lauderdale Lines: 27 Summary: Expires: Sender: Followup-To: Distribution: In article <915@husc6.harvard.edu> wen@husc4.UUCP (A. Wen) writes: : #include : : char inkey() : { : int count=0; : : ioctl(0,FIONREAD,&count); : return(count?getchar():NULL); : } Unix chauvinist! Not only that, but it's wrong. The function had better have a return value of int and return EOF or some other value that is guaranteed to not be a valid character. And it's not going to work if the attached terminal is line oriented. Presuming, of course, that the programmer has verified that the opened file really is a terminal.... The inkey function is almost never as trivial is y'all would like. When it can be done at all. --- Bill { uunet!proxftl | novavax } !twwells!bill