Wrox Programmer Forums
Go Back   Wrox Programmer Forums > PHP/MySQL > Moderated Pro PHP
|
Moderated Pro PHP This is a moderated forum for discussing advanced, professional level issues with PHP. Your posts will not appear until a moderator approves them. Posts that are not the right level for this forum will be responded to and you'll be asked to post them in the [url="http://p2p.wrox.com/sql-server-2000-20/9"]Beginning PHP[/url] forum instead.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Moderated Pro PHP section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 1st, 2005, 07:40 PM
Authorized User
 
Join Date: May 2004
Posts: 15
Thanks: 0
Thanked 0 Times in 0 Posts
Default Problems Reading file at a Byte level

Hello,

I am reading a file and trying to decifer individual bytes in a shockwave file and having a great deal of success. I'm having problems decoding an example.

The file is a compressed file and I can read most of the header information w/ no problem.

I encounter a bit of difficulty w/ this line of code:

$buffer = fread($fp, $this->size ) ;
$buffer = gzuncompress($buffer, $this->size);

$this->fps = Array() ;

for( $i=0; $i<2; $i++ )
{
$t = substr($buffer,0,1 ); #take the first byte in front
$t = ord($t) ;
$buffer = substr($buffer,1) ;
$this->fps[] = $t ;
}

the out put for the $this->fps[1] is 12 and the output for $this->fps[0] is 0;

the hex dump for the 2 bytes are: C0 C0

I know the bytes are being swapped somehow but I do not really understand how.

Any ideas?







Similar Threads
Thread Thread Starter Forum Replies Last Post
Writing byte array into image file yukijocelyn C# 2005 1 August 6th, 2008 03:45 PM
Help with PHP file reading XML file for output rydog65 Beginning PHP 0 March 26th, 2008 05:13 PM
File upload Problem, 0 byte!!!! MTLedari ASP.NET 2.0 Basics 6 December 19th, 2006 07:20 AM
Byte alignment or byte padding subodh_chettri C++ Programming 0 June 23rd, 2006 10:35 AM
READING EXE PROBLEMS! JamJunky VB How-To 0 September 10th, 2005 05:53 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.