Hi all,

Assume we've got a binary data file 'profile' which stores the data of a C
struct. The struct is as follows:

struct s_profile {
    char id[32];
    char vala:3;
    char valb:1;
    char valc:7;
}

Now I would like to read 'profile' using PHP's unpack(). So like this:
$f = fopen('profile', 'r');
$binaryData = fread($f, filesize('profile'));
$data = unpack('a32id/[...etc]', $binaryData);

My problem is: which formats should I use for char vala:3, char valb:1 &
char valc:7 ? In other words: what should be on the spot of [...etc] ?
cvala/cvalb/cvalc doesn't work.

Thanks,
Tim Molendijk



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

Reply via email to