On 21 Mar 2005 15:52:44 -0800, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > Hello, > > I am trying to convert some C code into python. > Here's the C code... > > typedef enum { > CODE1 = 0x1, > CODE2 = 0x2 > } CODE > testit(unsigned char *buffer, > unsigned long length, > CODE code) > { > unsigned long data > switch (code) > { > case CODE1: > while(len--) > { > *buffer++ = (unsigned long)data++ > } > break
CODE1 = 1 CODE2 = 2 def testit(code): data = 'somedata' if code == CODE1: return data In C, you pass a memory location to copy the result into. In Python, we return the result as an object. As for pointers, we don't need them. -- Stephen Thorne Development Engineer, NetBoxBlue.com -- http://mail.python.org/mailman/listinfo/python-list