select query
jsol at bbnccv.ARPA
jsol at bbnccv.ARPA
Wed Jan 30 09:25:56 AEST 1985
The code is:
boolean io_haschar(infile)
FILE *infile;
{
int readfds, nfound;
struct timeval timeout;
timeout.tv_sec = 10;
timeout.tv_usec = 0;
readfds = (1<<fileno(infile));
nfound = select(1, &readfds, 0, 0, &timeout);
if (nfound == 0)
return(FALSE);
if (readfds&(1<<fileno(infile)))
return (TRUE);
else
return(FALSE);
}
timeval is declared in sys/time.h.
The problem is: When I call this peice of code, it times out,
claiming infile has no characters ready to read. Examination of the
data stream (with a line monitor) indicates that a character is being
sent to the program, but somehow the program doesn't notice.
We are running Ultrix-32, and note the following disclaimer in the
documentation for select(2).
STATUS
SELECT(2) currently is not supported by Digital Equipment
Corporation.
Any hints as to what I'm doing wrong (if I am doing something wrong?)
Thanks,
--JSol
More information about the Comp.unix.wizards
mailing list