ctypes

luca72 lucaberto at libero.it
Wed Apr 29 02:49:10 EDT 2009


hello i have this api
PREF0 short usb_tc08_get_single (
  short   handle,
  float * temp,
  short * overflow_flags,
  short   units);

this is a sample program made in c
int main(void)
{
	short handle = 0;     /* The handle to a TC-08 returned by
usb_tc08_open_unit() */
	char selection = 0;   /* User selection from teh main menu */
	float temp[9];        /* Buffer to store temperature readings from
the TC-08 */
	int channel, reading; /* Loop counters */
	int retVal = 0;       /* Return value from driver calls indication
success / error */
	USBTC08_INFO unitInfo;/* Struct to hold unit information */

usb_tc08_get_single(handle, temp, NULL, USBTC08_UNITS_CENTIGRADE);

handle is c_short, but how a can define temp and the other two value?

myist.usb_tc08_get_single.argtypes = [ctypes.c_short, ctypes.c_float,
ctypes.c_short, ctypes.c_short] ----------is correct?
myist.usb_tc08_get_single.argtypes.restype = c_short   ------- is
correct?

but whe i call myist.usb_tc08_get_single(0,
[9],NULL,USBTC08_UNITS_CENTIGRADE )

i get argument 2 wrong type
can you explain how to execute this function
Thanks

Luca



More information about the Python-list mailing list