Get value of ctypes.c_ulong pointer?

For instance:

pointer = ctypes.POINTER(ctypes.c_ulong)
b = pointer(ctypes.c_ulong(20))

What should I get the value of int b?

+4
source share
1 answer

Do you mean to play bto get c_ulong(20)? That b.contents. Or do you mean, look where in memory the pointer indicates, as if it were an integer, not a pointer? This ctypes.cast(b, ctypes.c_ulong)(if the pointer fits into a long platform).

+6
source

All Articles