reading binary data
From: Roger Lord (rlord17889_at_yahoo.com)
Date: 08/31/04
- Next message: Daniel Tryba: "Re: reading binary data"
- Previous message: Colin McKinnon: "Re: Maintaining large scale PHP applications"
- Next in thread: Daniel Tryba: "Re: reading binary data"
- Reply: Daniel Tryba: "Re: reading binary data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 31 Aug 2004 08:46:22 -0400
I need to use php to read binary files that begin something like this:
00000000: 06 00 00 00 43 5f 54 4b 84 05 00 00 2c 00 00 00
00000010: 73 65 63 20 18 00 00 00 02 00 00 00 00 00 c0 40
00000020: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 20 c1
The first 4 bytes are a long number. I can't figure out how to fread
longs into an integer in php. Basically I need a function like:
$n = read_int($fp, $offset);
And the same thing for floats, doubles, shorts, unsigned shorts, etc.
How do you do this in php? I know that the file need to be opened in
binary mode, but fread just returns a string.
- Next message: Daniel Tryba: "Re: reading binary data"
- Previous message: Colin McKinnon: "Re: Maintaining large scale PHP applications"
- Next in thread: Daniel Tryba: "Re: reading binary data"
- Reply: Daniel Tryba: "Re: reading binary data"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|