redirecting an ostream's streambuf
ok, C++ gurus, please a little help:
I have an ostream (I've also tried iostream) and I wish to redirect it's streambuffer. By default the ostream is directed at cout via:
ostream *os = new ostream (cout.rdbuf());
however when I try to output to the ostream I get a segfault:
*os << "hello";
how can I properly redirect an ostream or iostream to a desired output?
Thanks,
jpbarto
|