I am trying to make a pointer of a struct and then de-reference it. But it's crashing. I have mimic'ed the behvior here with this simple code.
from ctypes import *
import ctypesclass File(Structure):_fields_ = [("fileSize", c_uint),("fileName", c_byte * 32)]f = File()
f.fileSize = 2
print(f.fileSize)
P = ctypes.POINTER(File)
p = P.from_address(addressof(f))
print(p.contents.fileSize)
Can someone point out what's the issue with this code?
Thanks in advance.