What is the difference between iostream
and iostream.h
?
h, iostream provides basic input and output services for C++ programs. iostream uses the objects cin , cout , cerr , and clog for sending data to and from the standard streams input, output, error (unbuffered), and log (buffered) respectively.
iostream is a library that have function like (cin cout int float...) Using namespace std is a shortcut if you want to make your code more clean.
Header files available in C++ for Input/Output operations are: iostream: iostream stands for standard input-output stream. This header file contains definitions of objects like cin, cout, cerr, etc. iomanip: iomanip stands for input-output manipulators.
iostream.h
is deprecated by those compilers that provide it, iostream
is part of the C++ standard.
To clarify explicitly there is no mention of iostream.h
at all in the current C++ standard (INCITS ISO IEC 14882 2003).
Edit: As @Jerry mentioned, not only does the current standard not mention it, but no standard for C++ mentions it.
iostream is a standard header. iostream.h is a non-standard header that was very common in pre-standard C++, and is what iostream evolved from. It's still common to have iostream.h around, presumably for use with older programs.
If your implementation have a working copy of iostream.h, it is probably the same as iostream except that everything in iostream is in the std
namespace, while iostream.h generally preceded namespaces, and didn't use them.
If your implementation has both iostream and iostream.h, iostream is likely to work like:
namespace std { #include <iostream.h> }
although that's not necessarily how it's written.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With