data pointer, binary string offset (newbie question)

data pointer, binary string offset (newbie question)

am 25.11.2007 03:25:05 von grande news

Hi,

I have a binary string containing a compressed image. I need to bypass the
header portion in order to pass a pointer to the correct uncompression
routine. Say the header is four bytes, can I just say $newdata = $data+4?
If not, how would I do that?

Thanks
B

Re: data pointer, binary string offset (newbie question)

am 25.11.2007 03:35:38 von Jerry Stuckle

Bint wrote:
> Hi,
>
> I have a binary string containing a compressed image. I need to bypass the
> header portion in order to pass a pointer to the correct uncompression
> routine. Say the header is four bytes, can I just say $newdata = $data+4?
> If not, how would I do that?
>
> Thanks
> B
>
>
>

No. This is not C. Pointer arithmetic does not work. You meed
something like substr($data, 4);

--
==================
Remove the "x" from my email address
Jerry Stuckle
JDS Computer Training Corp.
jstucklex@attglobal.net
==================

Re: data pointer, binary string offset (newbie question)

am 26.11.2007 04:45:55 von Kailash Nadh

If you want to skip the first 4 bytes, you could try something like
$data = substr($data, 4, strlen($data));

Regards,
Kailash Nadh
http://kailashnadh.name

On Nov 25, 2:25 am, "Bint" wrote:
> Hi,
>
> I have a binary string containing a compressed image. I need to bypass the
> header portion in order to pass a pointer to the correct uncompression
> routine. Say the header is four bytes, can I just say $newdata = $data+4?
> If not, how would I do that?
>
> Thanks
> B