sturlamolden schrieb:
On 5 Aug, 19:16, "Diez B. Roggisch" <de...@nospam.web.de> wrote:

void foo(void *data, size_t length)

The wrapper is supposed to be called with a python (byte)string instance,
which might contain more than one '\0'-character.

So how do I access the raw data of a string?

cdef extern void foo(void *data, int length)
cdef char *data
cdef int length
bytestring = ... #whatever

rawdata = <char *> bytestring
length = <int> len(bytestring)

And that gives me the *full* bytestring, not only until the first zero? I can't try that right now (not at work anymore), but if it's that easy, that would be great.

Diez
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to