Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!news.mixmin.net!feed.xsnews.nl!border-1.ams.xsnews.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:How': 0.09; 'received:mail-vb0-f46.google.com': 0.09; 'sep': 0.09; 'cc:addr :python-list': 0.10; "'r')": 0.16; 'googling': 0.16; 'height,': 0.16; 'posix': 0.16; 'subject:pass': 0.16; 'try?': 0.16; 'width,': 0.16; 'wrote:': 0.17; 'char': 0.17; 'received:209.85.212.46': 0.18; 'trying': 0.21; 'bit': 0.21; 'ctypes': 0.22; 'cheers,': 0.23; 'cc:2**0': 0.23; "i've": 0.23; 'cc:no real name:2**0': 0.24; 'specifically': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; 'header:In-Reply-To:1': 0.25; 'message-id:@mail.gmail.com': 0.27; 'received:209.85.212': 0.28; 'chris': 0.28; 'related': 0.30; 'ends': 0.30; 'fri,': 0.30; 'function': 0.30; 'file': 0.32; 'int': 0.33; 'raising': 0.33; 'skip:d 20': 0.34; 'received:google.com': 0.34; 'open': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'received:209': 0.37; 'subject:: ': 0.38; 'skip:o 20': 0.38; 'header:Received:5': 0.40; 'sender:addr:chris': 0.84; 'subject: *': 0.84; 'url:functions': 0.84 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=rebertia.com; s=google; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type; bh=FSCeVcZyNi2xliymCeCXvhOlvXqXW/gTogeMOrKZum0=; b=fqqbdmHGiJONwsy+8wxfas7Q6htYWmkhOU+9MW1xctbo8/kSnZlVXoY9MVWDvCXuyU WUFKYuDvyyAKsp2jZmHKyZuqKJNQpvlym/dOnTcXl21VapgzCt922HIH4H9RaHwAktwG N5wMxyAMtE3OVWCWovsOimsxIR/70cR4/KwPc= X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:sender:in-reply-to:references:date :x-google-sender-auth:message-id:subject:from:to:cc:content-type :x-gm-message-state; bh=FSCeVcZyNi2xliymCeCXvhOlvXqXW/gTogeMOrKZum0=; b=b5bNhrdpH+zEYyUjnLZ5hSmLrbZnPy6Xa3CIQn1RDh98fNOuiQAbAhvqIrSaFccukY afAFI6QATDemGD7W+76ohbKINQGA1aPJGzDhDI7+GrBGOYc9aeFQs6w24feas3uLyQ/f 5EGsi8ac3RPbbeyVDyvxzz14DFEe2kDMJrnpt5QIRMPWywVmIQBjZb9BW5/j45ahfVS2 G7tAVd8db5nf9OqfwEqZUZ/bynkvQjuPLcucWcvs75QTrXFU23J66cKfuuEqt9sNuNH0 Q+4Tg4W8O1lWsFYBM0FE6LIioVyEXl58F0iacMeKl0Uxr5NygS9ZVNaYl9n2JPUEABvz lZ/Q== MIME-Version: 1.0 Sender: chris@rebertia.com In-Reply-To: <201209281455.07702.thudfoo@gmail.com> References: <201209281455.07702.thudfoo@gmail.com> Date: Fri, 28 Sep 2012 21:27:13 -0700 X-Google-Sender-Auth: 0hFp0-j-6JwCx8D7Ky0LWDYWSp4 Subject: Re: How to pass FILE * From: Chris Rebert To: xDog Walker Content-Type: text/plain; charset=UTF-8 X-Gm-Message-State: ALoCoQk2vE971GuMZuVxfB5uyyFwzNe2j/PupQU2csnLMWWq3lyhO9yFJ6FVSMJP1fHJi85ci6+N Cc: python-list@python.org X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 26 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1348892836 news.xs4all.nl 6883 [2001:888:2000:d::a6]:38308 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:30466 On Fri, Sep 28, 2012 at 2:55 PM, xDog Walker 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