Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Difference between iostream and iostream.h

What is the difference between iostream and iostream.h?

like image 499
ckv Avatar asked Jun 04 '10 17:06

ckv


People also ask

What is iostream H used for?

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.

What is the difference between iostream and namespace std?

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.

What is #include iostream h in C++?

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.


2 Answers

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.

like image 117
Brian R. Bondy Avatar answered Sep 17 '22 14:09

Brian R. Bondy


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.

like image 36
David Thornley Avatar answered Sep 18 '22 14:09

David Thornley