Re: Editing a files hex?

From: Date: Wed, 21 Feb 2001 15:31:47 +0000
Subject: Re: Editing a files hex?
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-40968@lists.php.net to get a copy of this message
edit the file with php or an editor like ultraedit? in ultraedit hit Ctrl-H in php its no different then it would be opening an ascii file. no different, just make sure to use fwrite() http://www.php.net/manual/en/function.fwrite.php <?php function compress_output($output) { $crc = pack('V',crc32($output)); $size = pack('V',strlen($output)); $output = gzcompress($output, 9); $data = "\x1f\x8b\x08\x00\x00\x00\x00\x00"; $data .= substr($output, 0, strlen($output) - 4); $data .= $crc; $data .= $size; return $data; } $file_name = '/tmp/somefile.txt'; $file_p = fopen($filename, 'w+'); $file_data = fread($file_p, filesize($filename)); $file_data = compress_output($file_data); fwrite($fp, $file_data, strlen($file_data)); ?> -- Chris Lee Mediawaveonline.com em. lee@mediawaveonline.com ph. 250.377.1095 ph. 250.376.2690 fx. 250.554.1120 ""Matt"" <trottm@pmcolour.com> wrote in message news:008401c09c0c$14348220$64019998@mattt... Does anyone know how I can do this? I've got the file but before I write it to the server I was to change a hex value in the file, does anyone know how this could be done? Thanks, matt

« previous php.general (#40968) next »