Current status of iostream.h

Discussion in 'C Programming' started by Tim Cambrant, Aug 23, 2003.

  1. Tim Cambrant

    Tim Cambrant Guest

    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.
    Tim Cambrant, Aug 23, 2003
    #1
    1. Advertising

  2. Tim Cambrant

    Simon Biber Guest

    "Tim Cambrant" <> wrote:
    > 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.


    Then they are not teaching you C, but rather C++. If you intend to
    learn C++ then you should be reading/posting to comp.lang.c++
    instead.

    There is no iostream.h in C. There is no cin nor cout in C. The <<
    and >> operators only ever mean 'shift left' and 'shift right'.

    --
    Simon.
    Simon Biber, Aug 23, 2003
    #2
    1. Advertising

  3. Tim Cambrant

    Tim Cambrant Guest

    "nullptr" <_invalid_@_invalid_.net> skrev i meddelandet
    news:pan.2003.08.23.18.58.26.532336@_invalid_.net...

    > I think you are confuzing C++ with C. In C, the relevant cout/cin
    > counterparts are included in stdio.h.
    >
    > --
    > nullptr
    >


    Oh, of course I am... I've been down both roads, but never got anywhere, so
    I'm not surprised I would be mixing them together.

    You wouldn't have any idea of what is happening with the C++-library then,
    would you? (Might be good to know anyway, if i ever deal with C++ again).
    Thanks for the answer.
    Tim Cambrant, Aug 23, 2003
    #3
  4. Tim Cambrant wrote:
    > 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.


    The identifiers 'cin' and 'cout' have no defined meaning in C. They are in
    the user's namespace and have no predefined relationship to input or output.

    In the foul C++ language, these identifiers are defined in the 'std'
    namespace, but without qualification are in the user's namespace and
    unrelated to input or output, as 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.


    <iostream.h> is not a C or C++ header.
    The C header is <stdio.h>.
    The C++ headers are <iostream> and <cstream>.




    --
    Martin Ambuhl
    Martin Ambuhl, Aug 23, 2003
    #4
  5. Tim Cambrant

    Tim Cambrant Guest

    "Martin Ambuhl" <> skrev i meddelandet
    news:lMP1b.827$...
    > Tim Cambrant wrote:
    > > 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.

    >
    > The identifiers 'cin' and 'cout' have no defined meaning in C. They are

    in
    > the user's namespace and have no predefined relationship to input or

    output.
    >
    > In the foul C++ language, these identifiers are defined in the 'std'
    > namespace, but without qualification are in the user's namespace and
    > unrelated to input or output, as 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.

    >
    > <iostream.h> is not a C or C++ header.
    > The C header is <stdio.h>.
    > The C++ headers are <iostream> and <cstream>.
    >
    >
    >
    >
    > --
    > Martin Ambuhl
    >


    That clarifies it all somewhat. Thank you.
    Tim Cambrant, Aug 23, 2003
    #5
  6. Tim Cambrant

    Tim Cambrant Guest

    "Martin Ambuhl" <> skrev i meddelandet
    news:...
    > Tim Cambrant wrote:
    >
    > [posted & e-mailed, in case Tim has stopped following this thread]
    >
    > > "Martin Ambuhl" <> skrev i meddelandet
    > > news:lMP1b.827$...

    >
    > >>The C++ headers are <iostream> and <cstream>.

    >
    > I'm sorry; I erred. The C++ headers are <iostream> and <cstdio>.
    >
    > > That clarifies it all somewhat. Thank you.

    >
    > I hope this more correct version clarifies it a little more.
    >
    >
    >
    > --
    > Martin Ambuhl
    >


    No problem, thanks for the new information :)
    Tim Cambrant, Aug 23, 2003
    #6
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. John Tiger
    Replies:
    10
    Views:
    5,579
  2. Tim Cambrant

    Re: Current status of iostream.h

    Tim Cambrant, Aug 23, 2003, in forum: C++
    Replies:
    2
    Views:
    334
    Rolf Magnus
    Aug 23, 2003
  3. ai@work
    Replies:
    9
    Views:
    539
    Ron Natalie
    Dec 16, 2004
  4. S. Nurbe

    iostream + iostream.h

    S. Nurbe, Jan 14, 2005, in forum: C++
    Replies:
    7
    Views:
    769
    red floyd
    Jan 15, 2005
  5. red floyd
    Replies:
    3
    Views:
    533
    Dietmar Kuehl
    Mar 8, 2005
Loading...

Share This Page