I am using ctypes to access a file reading a C function in python. Since the data read is huge and unknown in size, I use **floatin C.
int read_file(const char *file,int *n_,int *m_,float **data_) {...}
Functions A mallocs2d array, called the datacorresponding size, is here nand m, and copies the values ββto reference. See the following snippet:
*data_ = data;
*n_ = n;
*m_ = m;
I am accessing this function with the following python code:
p_data=POINTER(c_float)
n=c_int(0)
m=c_int(0)
filename='datasets/usps'
read_file(filename,byref(n),byref(m),byref(p_data))
Then I try to use p_datawith contents, but I get only one float value.
p_data.contents
c_float(-1.0)
My question is: how can I access datain python?
What did you recommend? Please feel free to indicate if I left something incomprehensible!