LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   redirecting an ostream's streambuf (https://www.linuxquestions.org/questions/programming-9/redirecting-an-ostreams-streambuf-216415/)

jpbarto 08-11-2004 06:54 PM

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

jpbarto 08-11-2004 08:04 PM

nevermind, got it figured out... had a problem with my C++ constructors...


All times are GMT -5. The time now is 03:34 AM.