En Fri, 25 Apr 2008 09:30:56 -0300, Neal Becker <[EMAIL PROTECTED]> escribió:

I need an ioctl call equivalent to this C code:

    my_struct s;
    s.p = p; << a pointer to an array of char
    s.image_size = image_size;
    return (ioctl(fd, xxx, &s));

I'm thinking to use python array for the array of char, but I don't see how
to put it's address into the structure.

Use the array's buffer_info() method:
"""buffer_info(): Return a tuple (address, length) giving the current memory address and the length in elements of the buffer used to hold array's contents."""
<http://docs.python.org/lib/module-array.html>
and you can use the struct module to build my_struct.

Maybe ctypes is the answer?

It could be used too, but I think that in this case it's harder to use ctypes.

--
Gabriel Genellina

--
http://mail.python.org/mailman/listinfo/python-list
  • Re: ioctl, pass buffer address, howto? Gabriel Genellina

Reply via email to