Re: PyArg_ParseTuple for structs or binary data

2008-04-10 Thread Alvin Delagon
Hello Gabriel, I just recently discovered that struct.pack does return a string. Everything works fine now. Thanks for the heads up! static PyObject * sendMessage(PyObject *self, PyObject *args) { char *msg = ""; int len; if (!PyArg_ParseTuple(args, "s#", &msg, &len)) return NULL; ret

Re: PyArg_ParseTuple for structs or binary data

2008-04-10 Thread Alvin Delagon
Hello Gabriel, I just recently discovered that struct.pack does return a string. Everything works fine now. Thanks for the heads up! static PyObject * sendMessage(PyObject *self, PyObject *args) { char *msg = ""; int len; if (!PyArg_ParseTuple(args, "s#", &msg, &len)) return NULL; ret

Re: PyArg_ParseTuple for structs or binary data

2008-04-09 Thread Gabriel Genellina
En Wed, 09 Apr 2008 05:05:45 -0300, Alvin Delagon <[EMAIL PROTECTED]> escribió: > I'm currently writing a simple python SCTP module in C. So far it works > sending and receiving strings from it. The C sctp function sctp_sendmsg() > has been wrapped and my function looks like this: > > sendMessag

PyArg_ParseTuple for structs or binary data

2008-04-09 Thread Alvin Delagon
Hello fellow pythonistas, I'm currently writing a simple python SCTP module in C. So far it works sending and receiving strings from it. The C sctp function sctp_sendmsg() has been wrapped and my function looks like this: sendMessage(PyObject *self, PyObject *args) { const char *msg = ""; if