[c++-sig] Digest Number 54

David Abrahams abrahams at mediaone.net
Thu Nov 16 14:28:37 CET 2000


>    From: tom at malcolmson.com (Tom)

> I have seen it reported that the C++ iostreams library (and the C++ string
> class, which uses iostreams) should never be mixed with the C streams
> library.

I've seen it reported that if you eat pop rocks and drink coke, your stomach
will explode ;-)

> Given that Python uses the C streams library, does this mean that I can't
> use C++ iostreams with Python related code?

No. On the other hand, if you want to write to stdout/stderr coherently,
using std::cout/std::cerr to do it may have surprising results, since they
are buffered separately from the 'C' streams. There's a lot more to C++
iostreams than just cout/cerr, though. For example, you can make an
ostreambuf that writes to a 'C' FILE stream, or you can write to an
ostringstream and then write its contents into stdout yourself (less
convenient, but easier to implement).

that's-what-happened-to-mikey-you-know-the-life-cereal-kid-ly y'rs
dave





More information about the Cplusplus-sig mailing list