Currant status of iostream.h

T

Tom Picket

Hello, I'm relatively new to C, although I've touched the subject several
times for a couple of years. Tutorials etc. always taught me that I should
use (in the beginning at least) cin and cout when outputting text to the
screen.

Recently, when giving C another shot with the new GCC 3.3, I couldn't use
the functions defined in iostream.h anymore. I don't remember the actual
errors, but i think that the library had been separated into istream.h and
ostream.h. I seem to recall a warning as well, when using any of the
functions in those files.

Is iostream getting deprecated, or was I just using it wrong? I'm using GCC
2.95.4 at the moment, so I can't recreate the errors again for now. I do,
however, want to know if I should use iostream for file-io etc. or if
another library has taken it's place.

I like to be aware of how to do things the "right" way, and following
standards and so on, so a change of this caliber might as well catch my
radar now, so I won't have that problem the next time I'm confronted with a
newer GCC-version.

Any answers to this matter would be appreciated. Thank you.
 
U

user923005

Hello, I'm relatively new to C, although I've touched the subject several
times for a couple of years. Tutorials etc. always taught me that I should
use (in the beginning at least) cin and cout when outputting text to the
screen.

Recently, when giving C another shot with the new GCC 3.3, I couldn't use
the functions defined in iostream.h anymore. I don't remember the actual
errors, but i think that the library had been separated into istream.h and
ostream.h. I seem to recall a warning as well, when using any of the
functions in those files.

Is iostream getting deprecated, or was I just using it wrong? I'm using GCC
2.95.4 at the moment, so I can't recreate the errors again for now. I do,
however, want to know if I should use iostream for file-io etc. or if
another library has taken it's place.

I like to be aware of how to do things the "right" way, and following
standards and so on, so a change of this caliber might as well catch my
radar now, so I won't have that problem the next time I'm confronted with a
newer GCC-version.

Any answers to this matter would be appreciated. Thank you.

The include <iostream> is part of C++ and not part of C. If you
include <iostream> you no longer have a C program, but a C++ program.
The standard C++ header files do not use .h as part of the extension.
So <iostream.h> is an error. Also be aware that you now have to
qualify objects with the standard namespace.
Try news comp.lang.c++ for more information.
Follow-ups set.
 
F

Flash Gordon

Tom Picket wrote, On 21/12/07 20:59:
Hello, I'm relatively new to C, although I've touched the subject several
times for a couple of years. Tutorials etc. always taught me that I should
use (in the beginning at least) cin and cout when outputting text to the
screen.

In that case they were not C tutorials, they were probably C++ tutorials.
Recently, when giving C another shot with the new GCC 3.3, I couldn't use
the functions defined in iostream.h anymore. I don't remember the actual

<snip>

iostream.h was never part of C either.

I suggest you work out whether you want C or C++. If you want C++ then
this is the wrong place, but comp.lang.c++ is not far away. If you want
C then you need to start again since that is not what you have been
learning.
 
M

Martin Ambuhl

Tom said:
Hello, I'm relatively new to C, although I've touched the subject several
times for a couple of years. Tutorials etc. always taught me that I should
use (in the beginning at least) cin and cout when outputting text to the
screen.

Neither "cin" nor "cout" have any defined meaning in C.
Recently, when giving C another shot with the new GCC 3.3, I couldn't use
the functions defined in iostream.h anymore.

There is no such header as iostream.h in C. Nor, for that matter, is
there one in C++, which _does_ have <iostream>.

I believe you are confused about what language you are using. The
similarity of "C" and "C++" probably misled you; otherwise you might
have asked in comp.lang.fortran.
 
C

CBFalconer

Tom said:
Hello, I'm relatively new to C, although I've touched the subject
several times for a couple of years. Tutorials etc. always taught
me that I should use (in the beginning at least) cin and cout
when outputting text to the screen.

You are confused. There is no cin, cout, iostream.h, etc. in C.
Those things exist in that unmentioned (here in c.l.c) language
C++. It may be discussed in comp.lang.c++.

However, if you want to use C (which is an admirable objective),
get used to such functions as getc, putc, etc. There are many such
extant. Get the 2nd edition of the C language book, by Kernighan &
Ritchie. Read it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
474,438
Messages
2,571,698
Members
48,796
Latest member
Greg L.
Top