Req #45864 [Csd]: wish: fwrite to support direct output of bytes (not cast to string)
Edit report at https://bugs.php.net/bug.php?id=45864&edit=1
ID: 45864
Updated by: cmb@php.net
Reported by: php at richardneill dot org
Summary: wish: fwrite to support direct output of bytes (not
cast to string)
Status: Closed
Type: Feature/Change Request
Package: *General Issues
PHP Version: 5.2.6
-Assigned To:
+Assigned To: cmb
Block user comment: N
Private report: N
New Comment:
> [...} please feel free to close this as wontfix.
IMHO "closed" is fine: you've submitted a feature request, and
withdrew it after consideration. :)
Previous Comments:
------------------------------------------------------------------------
[2015-07-09 22:26:42] php at richardneill dot org
I the person who originally wrote this request, I think my 7-year-ago self didn't know enough C
to really realise what I was talking about. The pack() answer is clearly a better solution. Thanks
for your time, and please feel free to close this as wontfix.
------------------------------------------------------------------------
[2015-07-07 22:33:53] cmb@php.net
That seems too low-level to me. As PHP strings may contain
arbitrary bytes, you can easily build up the desired output
string(s) with pack('c*', ...) and write this/these to the file.
------------------------------------------------------------------------
[2008-08-19 15:50:44] php at richardneill dot org
Description:
------------
fwrite() outputs to file as a string. While this is usually a
sensible default, it can be rather annoying when I actually want to
output raw data. I know about using chr(), but that's ugly at least.
My request: add an option to fwrite that lets you output a char,
rather than a string.
[The chr() workaround is also not very visibly documented].
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=45864&edit=1
Thread (4 messages)