printf, data presentation

T. William Wells bill at twwells.uucp
Sun Jan 8 10:11:59 AEST 1989


In article <915 at husc6.harvard.edu> wen at husc4.UUCP (A. Wen) writes:
: #include <ioctl.h>
:
: 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



More information about the Comp.unix.wizards mailing list