struct unpack help?

Scherer, Bill Bill.Scherer at VerizonWireless.com
Thu Jul 11 14:58:34 EDT 2002


On 11 Jul 2002, Erno Kuusela wrote:

> In article <mailman.1026395600.7294.python-list at python.org>, "Scherer,
> Bill" <Bill.Scherer at VerizonWireless.com> writes:
> 
> | Here's a sample string of the struct:
> 
> | 	sampleStructString = "_782c1a08_p_void"
> 
> | I know that the struct defines only two unsigned shorts.  That 
> | would imply (to me, anyway) a format of 'HH'. But calcsize of 
> | that is 4, while my string is 16 bytes. So 
> 
> it appears you have a different definition of a struct than the
> struct module. if struct.calcsize('HH') returns 2, then it means
> that on your platforms shorts are 2 bytes each.
> 
> the "p_void" in your string makes me think it might encode a c pointer
> (void *). the characters "782c1a08" might be a machine address,
> interpreted as an ascii string containing a hexadecimal number.

I received an off-list email that got things moving.  I wasn't 
looking at a struct after all. The string came out of a swig 
generated module, and swig produces various _get and _set 
functions for dealing with the underlying structs from Python.

Thanks to the help, Python can now answer the phone...


> 
>   -- erno
> 

-- 
Bill.Scherer at Verizon Wireless
RHCE 807101044903581






More information about the Python-list mailing list