Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #30466 > unrolled thread

Re: How to pass FILE *

Started byChris Rebert <clp2@rebertia.com>
First post2012-09-28 21:27 -0700
Last post2012-09-28 21:27 -0700
Articles 1 — 1 participant

Back to article view | Back to comp.lang.python

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: How to pass FILE * Chris Rebert <clp2@rebertia.com> - 2012-09-28 21:27 -0700

#30466 — Re: How to pass FILE *

FromChris Rebert <clp2@rebertia.com>
Date2012-09-28 21:27 -0700
SubjectRe: How to pass FILE *
Message-ID<mailman.1606.1348892836.27098.python-list@python.org>
On Fri, Sep 28, 2012 at 2:55 PM, xDog Walker <thudfoo@gmail.com> wrote:
>
> 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.

What specifically did you try?

A tiny bit of googling suggests the following approach:
http://stackoverflow.com/questions/3794309/python-ctypes-python-file-object-c-file/3794401#3794401
Related POSIX docs:
http://pubs.opengroup.org/onlinepubs/009695399/functions/fdopen.html

Cheers,
Chris

[toc] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web