Created
August 6, 2012 19:34
-
-
Save nicolamontecchio/3277840 to your computer and use it in GitHub Desktop.
python ctypes - array conversion
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#let's say f_TI is something like | |
#void blabla(int *data, int data_length); | |
#then | |
f_TI.argtypes = [ctypes.POINTER(ctypes.c_int), ctypes.c_int] | |
lll = [4,7,2,8] | |
lll_c = (ctypes.c_int * len(lll))(*lll) | |
f_TI(lll_c, len(lll)) |
Hi, how to convert an address of array into array with ctypes ?
num_tics = api.SendMessage(self._hwnd, con.TBM_GETNUMTICS, 0, 0 ) - 2
addr = api.SendMessage(self._hwnd, con.TBM_GETPTICS, 0, 0)
Now, this addr is a pointer to an array of 9 DWORDs. How do I get the data ?
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thank you so much. I searched a whole internet for this ❤️