How to convert ctypes' c_long to Python's int?
Question:
int(c_long(1))
doesn’t work.
Answers:
>>> ctypes.c_long(1).value
1
>>> type(ctypes.c_long(1).value)
<type 'int'>
Use the ‘value’ attribute of c_long object.
c_long(1).value
or
i = c_long(1)
print i.value
int(c_long(1))
doesn’t work.
>>> ctypes.c_long(1).value
1
>>> type(ctypes.c_long(1).value)
<type 'int'>
Use the ‘value’ attribute of c_long object.
c_long(1).value
or
i = c_long(1)
print i.value