Re: How to write binary data to a file?

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27.07.2016 at 01:47, David Spector wrote:

> Clearly, the problem was with fwrite converting its value to a
> character. It shouldn't do this, IMO, since fwrite is documented as
> working both for string and binary arguments (depending on the 'b' mode
> of fopen).

The "b" mode only prevents line endings (CR/LF) to be converted to the
platform's convention.  "binary safe" means that NUL characters (\0) can
be contained in the string (contrary to C).

> Anyway, thank you for the solution, even though PHP is acting very
> non-intuitively here.

However, it is rather consistent with itself here.

-- 
Christoph M. Becker

-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php




[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux