Re: access string data from within cython

2009-08-05 Thread sturlamolden
On 5 Aug, 23:22, "Diez B. Roggisch" wrote: > 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. It should, and if it does not it is a bug in Cython. The len() function should wo

Re: access string data from within cython

2009-08-05 Thread Philip Semanchuk
On Aug 5, 2009, at 5:19 PM, Diez B. Roggisch wrote: Philip Semanchuk schrieb: On Aug 5, 2009, at 1:16 PM, Diez B. Roggisch wrote: Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. void foo(void *data, size_t length) The wrapper is supposed to

Re: access string data from within cython

2009-08-05 Thread Diez B. Roggisch
sturlamolden schrieb: On 5 Aug, 19:16, "Diez B. Roggisch" 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

Re: access string data from within cython

2009-08-05 Thread Diez B. Roggisch
Philip Semanchuk schrieb: On Aug 5, 2009, at 1:16 PM, Diez B. Roggisch wrote: Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. void foo(void *data, size_t length) The wrapper is supposed to be called with a python (byte)string instance, which

Re: access string data from within cython

2009-08-05 Thread sturlamolden
On 5 Aug, 21:23, sturlamolden wrote: > foo(data, length) Oops, that would be foo( data, length) -- http://mail.python.org/mailman/listinfo/python-list

Re: access string data from within cython

2009-08-05 Thread sturlamolden
On 5 Aug, 19:16, "Diez B. Roggisch" 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

Re: access string data from within cython

2009-08-05 Thread Philip Semanchuk
On Aug 5, 2009, at 1:16 PM, Diez B. Roggisch wrote: Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. 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

access string data from within cython

2009-08-05 Thread Diez B. Roggisch
Hi, I'm trying to wrap a C-API which has a call that takes a void* and a size_t as arguments. 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 str