struct module...

Peter Hansen peter at engcorp.com
Fri Mar 21 11:17:01 EST 2003


Franck Bui-Huu wrote:
> 
> I'm trying to read from a binary file data.
> These data have been written by a C soft using structure like
> struct xxx {
>     u1 length;
>     u1 array[length];
> }

What's a "u1"?  Is it an unsigned value of length one?  In that
case, why not just pull off the length byte first by indexing
the binary string "arrayLength = ord(arrayData[0])" and then
build the template to pass to struct() dynamically using that value?




More information about the Python-list mailing list