public inbox for gcc-help@gcc.gnu.org
 help / color / mirror / Atom feed
From: Claudio Bley <bley@cs.uni-magdeburg.de>
To: "Hillel (Sabba) Markowitz" <sabbahem@bcpl.net>
Cc: gcc-help@gcc.gnu.org
Subject: Re: g++ newbie prblem - gcc-3.0.3 vs gcc-2.95.3
Date: Fri, 18 Jan 2002 07:42:00 -0000	[thread overview]
Message-ID: <15432.16992.134224.726476@wh2-19.st.uni-magdeburg.de> (raw)
In-Reply-To: <3C483172@webmail.bcpl.net>

>>>>> "Hillel" == Hillel (Sabba) Markowitz <sabbahem@bcpl.net> writes:

    Hillel> The following program builds and runs fine under 2.95.3
    Hillel> but does not compile under gcc-3.0.3 As a g++ newbie I
    Hillel> must be doing something very obvious wrong.

    Hillel> Please respond via e-mail as I do not usually have access
    Hillel> to the mailing list archive.

    Hillel> #include <stdio.h> #include <stdlib.h> #include
    Hillel> <iostream.h> #include <fstream.h> #include <unistd.h>
    Hillel> main() { ofstream *fout = new ofstream (dup(1)); *fout <<
    Hillel> "Hello World\n"; }

[snip]

The C++ Standard does *not* specify a facility to assign a file
descriptor to a file stream because file descriptors are OS dependent.

If you want to redirect standard I/O channels you should assign the
stream buffers of stream objects to each other:

ostream ostr(0);
ostr.rdbuf (cout.rdbuf ());


Claudio

  reply	other threads:[~2002-01-18 15:42 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2002-01-18  6:31 Hillel (Sabba) Markowitz
2002-01-18  7:42 ` Claudio Bley [this message]
2002-01-19 16:44   ` Hillel (Sabba) Markowitz

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=15432.16992.134224.726476@wh2-19.st.uni-magdeburg.de \
    --to=bley@cs.uni-magdeburg.de \
    --cc=gcc-help@gcc.gnu.org \
    --cc=sabbahem@bcpl.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).