Mail Archives: djgpp/2000/01/30/14:14:04
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 -