in reply to nonblocking I/O - testing whether file has more data to read
#see which filehandles have output from perldoc -q filehandle $esize = pack("L", 0); ioctl(\*ERROR, FIONREAD(), $esize) or die "Couldn't call ioctl: +$!\n"; $esize = unpack("L", $esize); print "esize-> $esize\n" unless ($esize < 1); $rsize = pack("L", 0); ioctl(\*READ, FIONREAD(), $rsize) or die "Couldn't call ioctl: $ +!\n"; $rsize = unpack("L", $rsize); print "rsize-> $rsize\n" unless ($rsize <1); #get the output from bc if($esize > 0){sysread(ERROR,$error,$esize); $errortot = $errorto +t.$error} if($rsize > 0){sysread(READ,$answer,$rsize); $answertot = $answer +tot.$answer} } until(($esize > 0)or(($rsize > 0)and($rsize < 4060)));
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Re: nonblocking I/O - testing whether file has more data to read
by hv (Prior) on Apr 12, 2004 at 16:24 UTC |