Message117637
The following program should print "0xdead" but instead prints "0x0". This came from the following stackoverflow question:
http://stackoverflow.com/questions/3824617/python-structure-always-stuck-at-0-no-matter-what-value-you-assign-to-it
import ctypes
class Blah(ctypes.Structure):
_fields_ = [("a", ctypes.c_uint64, 64),
("b", ctypes.c_uint16, 16),
("c", ctypes.c_uint8, 8),
("d", ctypes.c_uint8, 8)]
x = Blah(0xDEAD,0xBEEF,0x44,0x12)
print(hex(x.a)) |
|
Date |
User |
Action |
Args |
2010-09-29 18:34:54 | stutzbach | set | recipients:
+ stutzbach, theller |
2010-09-29 18:34:54 | stutzbach | set | messageid: <1285785294.07.0.231109223206.issue9989@psf.upfronthosting.co.za> |
2010-09-29 18:34:52 | stutzbach | link | issue9989 messages |
2010-09-29 18:34:51 | stutzbach | create | |
|