LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Go Back   LinuxQuestions.org > Forums > Non-*NIX Forums > Programming
User Name
Password
Programming This forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.

Notices


Reply
  Search this Thread
Old 08-11-2004, 06:54 PM   #1
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Rep: Reputation: 45
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
 
Old 08-11-2004, 08:04 PM   #2
jpbarto
Senior Member
 
Registered: Mar 2003
Location: Pittsburgh, PA
Distribution: Gentoo / NetBSD
Posts: 1,251

Original Poster
Rep: Reputation: 45
nevermind, got it figured out... had a problem with my C++ constructors...
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
help with redirecting to ftp SlipAway172 Linux - Networking 1 03-06-2005 08:47 AM
port redirecting st3reo Linux - Networking 3 11-12-2004 05:35 PM
streambuf.h error during ./configure evilregis Linux - Software 0 03-07-2004 01:03 AM
Redirecting Half_Elf Linux - Networking 2 09-04-2002 10:51 PM
about port redirecting cmardhekar Linux - Newbie 1 09-13-2001 07:29 AM

LinuxQuestions.org > Forums > Non-*NIX Forums > Programming

All times are GMT -5. The time now is 09:06 PM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Open Source Consulting | Domain Registration