printf, data presentation
A. Wen
wen at husc4.HARVARD.EDU
Thu Jan 5 10:16:40 AEST 1989
In article <8332 at ihlpl.ATT.COM> knudsen at ihlpl.ATT.COM (Knudsen) writes:
>Most OSes make the inkey() function possible, but hardly easy.
>I know it takes a lot of ioctl() bashing.
...
>My point is that some guru should have figured out how to do
>inkey() on the OS in question and put this in the library.
>Then ordinary programmers wouldn't have to figure it out
>for the zillionth time.
But it's very, very easy:
(with cbreak mode set)
#include <ioctl.h>
char inkey()
{
int count=0;
ioctl(0,FIONREAD,&count);
return(count?getchar():NULL);
}
A. Wen wen at husc4.HARVARD.EDU wen at husc4.BITNET {seismo!harvard!husc4}
More information about the Comp.unix.wizards
mailing list