[C++-sig] V2: python file object as an ostream argument

David Abrahams david.abrahams at rcn.com
Sat Jun 1 22:29:55 CEST 2002


From: "Pearu Peterson" <pearu at cens.ioc.ee>

>
> I tried google but there I got very contradictionary results. E.g. in
> gcc-2.95.3 there is ostdiostream to make this connection but in gcc-3.x
> ostdiostream does not exist anymore.
>
> Any hints how to solve this issue are very much appeciated.

This question really has nothing to do with Python; you just want to know
how to make an ostream given a FILE*. It's unfortunate that C++ doesn't
have such a facility built-in. I think the right way to do this is to build
a streambuf around the FILE*. I believe "The C++ Standard Library", by
Nicolai Josuttis, contains the code for such a thing. You might also look
at newsgroup postings by Dietmar Kuehl.

Good Luck,
Dave







More information about the Cplusplus-sig mailing list