[Pyrex] newbie question about char array

Stefan Behnel behnel_ml at gkec.informatik.tu-darmstadt.de
Sun May 7 08:40:43 CEST 2006


Yuan Mang wrote:
> I have some problem in wrapping a c function that take a char array as
> parameter.

Maybe you should just read the docs and the tutorial on these things. Pyrex
nicely converts between char* and Python strings. Just say:

cdef char* mystring
mystring = "test"
mypythonstring = "test"
mystring = mypythonstring

...

As for char**, you can say "&mystring". If you need a pointer to an output
buffer, you can malloc one and pass the pointer.

Stefan




More information about the Pyrex mailing list