Ctypes: construct pointer from arbitrary integer?

You can use ctypes. Cast(addr, type) I'll extend your example to acquire an address via a known object, to demonstrate.

You can use ctypes. Cast(addr, type). I'll extend your example to acquire an address via a known object, to demonstrate: INTP = ctypes.

POINTER(ctypes. C_int) num = ctypes. C_int(42) addr = ctypes.

Addressof(num) print 'address:', addr, type(addr) ptr = ctypes. Cast(addr, INTP) print 'pointer:', ptr print 'value:', ptr0 Output: address: 4301122528 pointer: value: 42.

That does the trick, thanks! – sebulba Apr 26 at 8:34 1 @sebulba: and if it does, mark the answer as correct, please :) – vines May 26 at 14:32.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions