[Tutor] Struct headspinner

Liam Clarke ml.cyresse at gmail.com
Wed Oct 12 11:45:52 CEST 2005


Hi all,

Erm, can someone please aid me? I'm using Windows XP, haven't tested
this code on Linux yet, but, well watch this...

'<' indicates little-endian, @ indicates native. i is an integer, q is a long.

>>> struct.calcsize('<3i')
12
>>> struct.calcsize('@3i')
12
>>> struct.calcsize('<3iq')
20
>>> struct.calcsize('@3iq')
24
>>> struct.calcsize('@4iq')
24

Is this a feature I don't understand? Is a long preceded by 3 integers
really 12 bytes long?
Surely Microsoft wouldn't do that?

Regards,

Liam Clarke


More information about the Tutor mailing list