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)

foo(data, length)


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

Reply via email to