<fstream> vs <fstream.h> 
Author Message
 <fstream> vs <fstream.h>

I am very new to STL, so bear with me.

Can anyone explain to me the difference between the iostream library and the
iostreams included in STL?  As my subject line indicates I've discovered to
types of stream classes in VC++ 6 and don't understand the difference.

Along with that could anyone describe the reasons for using one over the
other?

--
-Brett-



Tue, 04 Feb 2003 03:00:00 GMT  
 <fstream> vs <fstream.h>

Quote:

> I am very new to STL, so bear with me.

> Can anyone explain to me the difference between the iostream library and the
> iostreams included in STL?  As my subject line indicates I've discovered to
> types of stream classes in VC++ 6 and don't understand the difference.

What is confusing is that you think the STL has an iostream library as
opposed to a non-stl iostream library.  That is NOT the case.

C++ has only one iostream library, and it is included by #including
<iostream> without the .h.  The only reason the .h version exists is
for old C++ code that uses the "traditional" iostream library, but it
is NOT standard C++ anyway, and shouldn't be used unless you're
working with old code.

Quote:
> Along with that could anyone describe the reasons for using one over the
> other?

New code or old, standard C++ or non-standard c++.  

--
Chris



Tue, 04 Feb 2003 03:00:00 GMT  
 <fstream> vs <fstream.h>

So are you saying that <iostream> and <iostream.h> are really a part of C++
and have nothing to do with STL?

If that is the case then what is the difference between the two?  Was the
standard changed at some point, or was there no standard before <iostream>?

I'm just looking for some clarity on what the situation is, more than just
the fact that I should use <iostream> instead of <iostream.h>.

Thanks.

--
-Brett-


Quote:

> > I am very new to STL, so bear with me.

> > Can anyone explain to me the difference between the iostream library and
the
> > iostreams included in STL?  As my subject line indicates I've discovered
to
> > types of stream classes in VC++ 6 and don't understand the difference.

> What is confusing is that you think the STL has an iostream library as
> opposed to a non-stl iostream library.  That is NOT the case.

> C++ has only one iostream library, and it is included by #including
> <iostream> without the .h.  The only reason the .h version exists is
> for old C++ code that uses the "traditional" iostream library, but it
> is NOT standard C++ anyway, and shouldn't be used unless you're
> working with old code.

> > Along with that could anyone describe the reasons for using one over the
> > other?

> New code or old, standard C++ or non-standard c++.

> --
> Chris



Tue, 04 Feb 2003 03:00:00 GMT  
 <fstream> vs <fstream.h>

Quote:

> So are you saying that <iostream> and <iostream.h> are really a part of
C++
> and have nothing to do with STL?

It is probably a good idea to forget about the headers "belonging" to the
STL (as there is really no such thing). <iostream> is an ANSI Standard C++
header file.

Quote:
> If that is the case then what is the difference between the two?  Was the
> standard changed at some point,

No.

or was there no standard before <iostream>?

Correct.

Quote:
> I'm just looking for some clarity on what the situation is, more than just
> the fact that I should use <iostream> instead of <iostream.h>.

Read a book? But make sure it is one that specifically addreses ANSI
Standard C++. I can strongly recommend:

The C++ Standard Library - A Tutorial and Reference, Josuttis, 1999

and with less enthusiasm:

Standard C++ Iostreams & Locales, Langer & Kreft, 1999

NeilB



Wed, 05 Feb 2003 03:00:00 GMT  
 
 [ 4 post ] 

 Relevant Pages 

1. <<<<<<<Parsing help, please>>>>>>>>

2. File Format conversion, ascii freeform -->.csv <-->.wk1<-->dbf<-->?HELP

3. <<<>>>Need C code advice with functions and sorting.<<<>>>

4. <><><>HELP<><><> PCMCIA Motorola Montana 33.6

5. pb with replacing <fstream.h> by <fstream>

6. <fstream.h> and <fstream> chaos

7. <fstream.h> or <fstream>

8. #include <fstream> or <fstream.h>?

9. >>>Windows Service<<<

10. <fstream>

11. <fstream> and file sharing

12. basic_string<>::data() vs basic_string<>::c_str()

 

 
Powered by phpBB® Forum Software