How to get the value from void pointer integer in ctypes if we know the type?

时间:2016-04-12 00:46:49

标签: python ctypes

Following Doc

libc = CDLL("libc.so.6") 
>>> strchr = libc.strchr
>>> strchr("abcdef", ord("d")) 
8059983
>>> strchr.restype = c_char_p # c_char_p is a pointer to a string
>>> strchr("abcdef", ord("d"))
'def'

Now, suppose I have 8059983 from strchr("abcdef", ord("d")) , how can I get def without changing restype? Is there a dereference function somehow?

0 个答案:

没有答案