Hi all,

I'm wrestling with this problem for a while now. I want to read a binary
file (created by C software) using PHP. I know of unpack(). But the C struct
that is stored in the binary file contains variables with bitfields:

struct some_struct {
    char val_a : 2
    int val_b : 7
}

Such a construct means that val_a is char with a bitfield of 2 and therefore
can contain values between 0 (00 binary) and 3 (11 binary). val_b is an
integer with a range of 0 (0000000) to 127 (1111111).

Now the problem is: how on earth do I handle those values with PHP's
unpack()?!? I've tried a lot of syntaxes but none of them seem to work. Can
someone please shortcut whether it is possible or not and if yes, *how*?

Thanks in advance,
Tim



-- 
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to