php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #18143 writing binary number as raw binary
Submitted: 2002-07-03 12:57 UTC Modified: 2002-07-03 13:21 UTC
From: ericksbr at infocon-inc dot com Assigned:
Status: Not a bug Package: Filesystem function related
PHP Version: 4.1.2 OS: Windows NT 4.0 SP 5 (Intel)
Private report: No CVE-ID: None
 [2002-07-03 12:57 UTC] ericksbr at infocon-inc dot com
Basically, what I want to do is write the
hexadecimal value "0x0F000000L" out to a file,
without it being converted to a string.
I am using a C program to read the file and
the results don't match.

// #define COUNT_FLAG		0x0F000000L
define("COUNT_FLAG", "251658240", FALSE);
// define("COUNT_FLAG", "0x0F000000", FALSE);
	// Open file
	$fp = fopen($sTempFileName, "ab");

	fwrite($fp, COUNT_FLAG);
	// Copy Count
	fwrite($fp, $nCopyCount);
	fwrite($fp,
		intval(COUNT_FLAG)
		);
	fwrite($fp,
		serialize(intval($nCopyCount))
		);
	fclose($fp);

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2002-07-03 13:21 UTC] sander@php.net
Sorry, but the bug system is not the appropriate forum for asking
support questions. Your problem does not imply a bug in PHP itself.
For a list of more appropriate places to ask for help using PHP,
please visit http://www.php.net/support.php

Thank you for your interest in PHP.

Hint: use chr()
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 26 00:01:30 2024 UTC