input ready under UNIX ??!!??
John A. Ebersold
vfm6066 at dsacg3.UUCP
Sat Oct 29 00:06:38 AEST 1988
Several years ago, on a PDP-11 under Ultrix-11 I did basically the following:
(Forgive the pigdin C :-) ).
long l;
fp = fopen(the tty);
fd = fileno(fp);
if (ioctl(fd, FIONREAD, &l) != -1)
if (l > 0)
printf("There are characters\n");
I believe this is a Berkeleyism - the flavor I am not sure of.
There is also fcntl:
fcntl(fd, FNDELAY, arg);
To quote the manual:
"nonblocking I/O; if no data is available to a read call, or if a write
operation would block, the call returns -1 with the error EWOULDBLOCK."
Also a Berkeleyism.
More information about the Comp.lang.c
mailing list