How to check for data on a popen()ed FD?
| From: | Andre | Date: | Fri, 20 Sep 2002 09:27:33 +0000 |
| Subject: | How to check for data on a popen()ed FD? | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-117008@lists.php.net to get a copy of this message | ||
I'm running a program using popen(), and I need to know when there's data to
be read from this program. feof() will never return true, even with no data
to be read. Is there any function that can set a timeout on a file descriptor
returned by popen()? Or a function like feof(), but to check if there's data
to be read from a popen() file descriptor?
What I'm doing here is running Crafty (a chess engine), from my PHP script,
and I need to get input from the user on stdin and from Crafty.
Any help is appreciated!
Thanks!