Re: Need help with streams
| From: | Sara Golemon | Date: | Mon, 14 Jun 2004 17:10:28 +0000 |
| Subject: | Re: Need help with streams | ||
| References: | 1 | Groups: | php.internals |
| Request: | Send a blank email to internals+get-10446@lists.php.net to get a copy of this message | ||
> But I do not know how to write the value to the stream
>
> php_stream_write(stream, (char*)Z_LVAL_P(*data), 1);
>
> This does not produce the result I need, instead the file contains 48 at
> this position.
>
That's because you're telling it to write one character from the position
POINTED TO by the integer value. (i.e. Treat the integer like a pointer)
You're lucky you're getting data at all and not a segfault.
Try:
php_stream_putc(stream, (char)(Z_LVAL_P(*data) & 0xFF));
-Sara