[Pyrex] Mapping a stdio-FILE to a Python-file

Greg Ewing greg at cosc.canterbury.ac.nz
Tue Nov 18 01:09:31 CET 2003


Joachim Saul <saul at gfz-potsdam.de>:

> What is the best way to map a stdio-FILE to a Python-file object in
> Pyrex?

You could use the following Python/C API function:

  FILE* PyFile_AsFile(PyFileObject *p)
    Returns the file object associated with p as a FILE*.

> Ideally, I would like Pyrex to directly map the file object to a FILE,
> since both are standard types in their respective languages.

That's an idea worth considering -- I'll add it to my list.

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg at cosc.canterbury.ac.nz	   +--------------------------------------+




More information about the Pyrex mailing list