From: "Alex Vinokur" Newsgroups: comp.os.msdos.djgpp,gnu.g++.help Subject: Re: ofstream and rdbuf() Date: Thu, 19 Dec 2002 22:17:55 +0200 Lines: 51 Message-ID: References: NNTP-Posting-Host: pop03-2-ras1-p97.barak.net.il (212.150.97.97) X-Trace: fu-berlin.de 1040329100 2818671 212.150.97.97 (16 [79865]) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-Mimeole: Produced By Microsoft MimeOLE V5.50.4522.1200 To: djgpp AT delorie DOT com DJ-Gateway: from newsgroup comp.os.msdos.djgpp Reply-To: djgpp AT delorie DOT com "Thomas Maeder" wrote in message news:m2fzstg7fo DOT fsf AT glue DOT ch... > "Alex Vinokur" writes: > > > =============== > > Windows 2000 > > DJGPP 2.03 > > GNU gcc/gpp 3.1 > > =============== > > > > > > I have got compilation errors related to ofstream and rdbuf(). > > Is there any way to do what I want to ? > > A much shorter test program would have been enough ... > > > > #include > > #include > > #include > > using namespace std; > > > > int main () > > { > > streambuf *psbuf_cout; > > ofstream file1; > > file1.open ("f1.txt"); > > psbuf_cout = cout.rdbuf(); > > file1.rdbuf(psbuf_cout); // Line#61 > > There is an overload of rdbuf() in std::ofstream which hides the > std::ostream::rdbuf() version you attempt to call. Your options include: > > file1.std::ostream::rdbuf(psbuf_cout); Thanks. It works OK. > > and > > static_cast(file1).rdbuf(psbuf_cout); -- ============================== Alex Vinokur mailto:alexvn AT go DOT to http://www.simtel.net/pub/oth/19088.html ==============================