Re: Returning a byte buffer from C extension

2008-03-05 Thread forwardshortleg
I just realized that I could do this as follows: static PyObject* GetByteBuffer(PyObject* self, PyObject* args) { char byteBuffer[100]; // do something to fill byteBuffer with values. return Py_BuildValue("s#", byteBuffer, numberOfBytesToReturn); } Sorry for the unnecessary distract

Returning a byte buffer from C extension

2008-03-05 Thread forwardshortleg
Hello, I am new to Python programming. So, kindly excuse me if I don't use correct terminology here below. I am trying to write an extension function that returns an array of bytes as shown in the example below: static PyObject* GetByteBuffer(PyObject* self, PyObject* args) { char byteBuff