Treat C FILE* as C++ streams

Michele De Stefano micdestefano at
Thu Jun 4 09:52:56 CEST 2009

Hello to everyone.

I'm an Italian engineer and I'm approaching to Python, particularly to
Python extension through C++ (because I'm an experienced C++ programmer).

I've seen that Python files are basically managed through the C FILE pointer.
I've recently released on Google Code a very small library which allows to
treat the C FILE* as a C++ stream and I think this should be useful to
Python developers.

The link is this:

The library uses Boost.Iostreams.

Think to this situation: you have some C++ classes or functions that
take a C++ stream or
fstream as parameter. You want to make a Python extension from this
library but you want
to pass a Python file object to your C++ code. Using my library, you
can wrap the underlying
FILE* into an object that behaves like a C++ stream.

I've not yet built an on-line documentation, but the library comes
with detailed doxygen documentation and useful examples.

I hope my library will be useful to the Python community and I'd like
to see a link to it on the
Python web site.

Best regards to all of you.


Michele De Stefano

More information about the Python-announce-list mailing list