Re: How to pass FILE *
LukenShiro <[email protected]> Sat, 29 Sep 2012 14:09:56 +0200
| Newsgroups | gmane.comp.python.ctypes |
|---|---|
| Message-ID | <[email protected]> |
Il giorno Fri, 28 Sep 2012 14:03:06 -0700 xDog Walker <[email protected]> ha scritto: > The function I am trying to call wants a FILE *: > > dlg_progressbox(const char *title, > const char *cprompt, > int height, > int width, > int pauseopt, > FILE *fp) > > I can open the file to be referenced: > > fp = os.fdopen(self.pipefds[0], 'r') > > Every thing I've tried ends with ctypes raising a TypeError. > AFAIK you can use (FILE is defined in /usr/include/stdio.h): """ class _IO_FILE(ctypes.Structure): pass FILE = _IO_FILE """ then you can use (as type for 'FILE *'): ctypes.POINTER(FILE) -- GNU/Linux * Slackware64 current LU #210970 SU #12583 LM #98222/#412913 "My Desktop is proudly De-Poettering-ized, and yours?" ------------------------------------------------------------------------------ How fast is your code? 3 out of 4 devs don\\\'t know how their code performs in production. Find out how slow your code is with AppDynamics Lite. http://ad.doubleclick.net/clk;262219672;13503038;z? http://info.appdynamics.com/FreeJavaPerformanceDownload.html