Главная страница | назад





Article #15668: sending output to do different streams

 Question and Answer Database
FAQ668C.txt sending output to do different streams
Category :C/C++ Language Issues
Platform :All
Product :BC++ 5.x
Question:
is there a way to create an ostream that writes to two locations,
for example, i'd like to send error messages both to cerr and a
log file.
Answer:
basically, you want to derive a class from streambuf and for
each of it's virtuals forward the call onto the destinations.
dupstream.h and dupstream.cpp implement such a set of classes.
see dupstrt.cpp for an example on how to use it.
5/7/98 5:13:12 PM

Last Modified: 01-SEP-99