Re: library calls from within php functions
| From: | Wez Furlong | Date: | Sun, 20 Oct 2002 09:07:48 +0000 |
| Subject: | Re: library calls from within php functions | ||
| References: | 1 | Groups: | php.dev |
| Request: | Send a blank email to php-dev+get-89762@lists.php.net to get a copy of this message | ||
On 10/20/02, "Tony Leake" <tony@php.net> wrote:
> and now I'm trying to write functions that will read and write from the
> pipe. So far I have this, it isn't finished as you will see.
>
> PHP_FUNCTION(pipe_read)
> {
> pipe_r_le_struct *st_pipe_r;
> zval *read;
> zval * res;
> char buf[1024];
>
> if (zend_parse_parameters(ZEND_NUM_ARGS() TSRMLS_CC, "r", &res) ==
> FAILURE) {
> return;
> }
>
> ZEND_FETCH_RESOURCE(st_pipe_r, pipe_r_le_struct *, &res, -1,
> "pipe_r", le_pipe_r);
>
Try using curly brackets:
if (!st_pipe_r) {
RETURN_FALSE;
}
Any I take it you mean this:
read(st_pipe_r->fd, buf, sizeof(buf));
> if(!st_pipe_r) RETURN_FALSE;
>
> read(fd, buf, sizeof(buf));
> }
Aside from that, I can't see any obvious mistakes.
--Wez.