delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/2000/01/30/14:14:04

Newsgroups: comp.os.msdos.djgpp
From: manni DOT heumann AT gmx DOT de (Manni Heumann)
Subject: Re: missing <ostream>
References: <A07BFA639570509F DOT 80D3BEF731426AC0 DOT B418A6AEF5DF1D20 AT lp DOT airnews DOT net> <38910E6A DOT DF22D15A AT americasm10 DOT nt DOT com> <389169e4$1 AT news DOT uni-bielefeld DOT de> <E1D0A4CADBAC5FC0 DOT 8E50956E4A580C85 DOT 79A2A03D8020D9D0 AT lp DOT airnews DOT net>
X-Newsreader: News Xpress 2.01
Date: Sun, 30 Jan 2000 15:59:04 GMT
NNTP-Posting-Host: ppp36-209.hrz.uni-bielefeld.de
Message-ID: <38945fce@news.uni-bielefeld.de>
X-Trace: 30 Jan 2000 16:59:10 +0200, ppp36-209.hrz.uni-bielefeld.de
Lines: 49
To: djgpp AT delorie DOT com
DJ-Gateway: from newsgroup comp.os.msdos.djgpp
Reply-To: djgpp AT delorie DOT com

In article <E1D0A4CADBAC5FC0 DOT 8E50956E4A580C85 DOT 79A2A03D8020D9D0 AT lp DOT airnews DOT net>, Rodeo Red <rodeored AT netstep DOT net> wrote:
>Manni Heumann wrote:
>> 
>> Standard headers in C++ don't come with a suffix.
>> libgpp should not be necessary for C++, you only need it to compile legacy
>> code (e.g. to compile programs that use the String class).
>> 
>> But what sort of functionality should <ostream> contain?
>
>It opens a file for output. from my text books it seems to be part of
>the standard library. 
>AFAIK, that measn it should be in djgpp and I probably lost it.  It
>would be nice if someone could simply verify whether or not <ostream is
>supposed to be in dgjpp or not. 
>
> 
>> AFAIK once you include <fstream> you don't have to worry about the
> subclasses.
>> Try to change the #include lines below with this:
>> #include <fstream>
>> #include <string>
>> 
>> I bet it will compile then.
>
>Those headers are already included. If I just erase "#include <ostream>"
>the program compiles but doesn't work correctly. I get a message telling
>me a file failed to open.  

I know they are. The point is: Once you've got <fstream> you no longer need 
<iostream> or <ostream>.
If you want to open files for input or output, just use <fstream>. 

GCC may not be fully compliant to the C++ standard. But in this case it won't 
keep you from writing standard compliant code.

Your program compiles fine on my system, once I remove the #include <ostream> 
line. And it will also run and from what I can see, it does what it is 
supposed to do.

Btw: While C programs may compile even if you forget to include necessary 
headers, but then come up with the wrong behavior, C++ programs won't compile 
in this case. If they compile and their behavior is not the expected, changes 
are that the mistake is within your code.


--

Manni

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019