On Mar 17, 10:59 pm, [EMAIL PROTECTED] wrote: > You can also do it with ctypes only; too bad it's not really well > documented. c_float is a type of a floating point number and it has * > operator defined, so that c_float*4 is a type of a 4-element array of > those numbers. So if you want to construct an array of floats from a > list of floats, you can do it like this: > > from ctypes import c_float > > x = [1.0, 1.1, 1.2, 1.3, 1.4, 1.5, 1.6, 1.7, 1.8, 1.9] > float_array_type = c_float*len(x) > float_array = float_array_type(*x) > print float_array
Is there has any difference between the following arrays ? Buf0=(c_float* 9)(57,57,57,57,57,5,5,5,5) Buf0=array('f', [57,57,57,57,57,5,5,5,5]) function called like this in python: ret= SetAnalog(9,Buf0) function prototype in C like this int SetAnalog(UINT uChannel,float* pBuf) { ....... }
-- http://mail.python.org/mailman/listinfo/python-list