Re: Gtk::input_add() for a popen() filehandle?
| From: | James Cameron | Date: | Mon, 01 Apr 2002 12:25:11 +0000 |
| Subject: | Re: Gtk::input_add() for a popen() filehandle? | ||
| References: | 1 2 | Groups: | php.gtk.general |
| Request: | Send a blank email to php-gtk-general+get-1687@lists.php.net to get a copy of this message | ||
G'day Alan,
Thanks for your comments on this.
I've just tried doing as you suggest; adding a debugging php_error call
to gtk.overrides, but I'm afraid I don't understand the output. What I
got for a popen() filehandle was ...
Debugging input_add : 842e8d0 138602704
Despite changing the rsrc_type to check against php_file_le_popen() not
php_file_le_fopen(), the input function is not being called. So I worry
that the PHP popen and fopen types are not compatible ... that is they
are not both a plain FILE pointer as they are in C. Can you point to
the appropriate place in the PHP source? I don't know my way around it
yet.
My callback function ...
function on_start_activate() {
global $fp, $gu;
$fp = popen("sleep 1;date;sleep 1;date;sleep 1;date", "r");
$gu = Gtk::input_add($fp, GDK_INPUT_READ, "reader");
}
... and the reader function ...
function reader() {
global $fp, $gu;
echo "reader: entry\n";
$line = fgets($fp, 1024);
echo "reader: $line";
if (feof($fp)) {
echo "reader: eof after fgets\n"; pclose($fp); return false; }
return true;
}
However, reader() is not being called.
--
James Cameron mailto:quozl@us.netrek.org http://quozl.netrek.org/