iostream or stdio

Discussion in 'C++' started by Vicent, Aug 25, 2003.

  1. Vicent

    Vicent Guest

    Hi all:

    I work with C++ builder 3.0 and I need to read and process a text
    file. I wonder what is the best tool to do it, the iostream library or
    the stdio library.

    What´s the difference between them?

    Maybe this is a silly question, but I´m a newbie...

    Thanks in advance:
    Vicent Vidal
     
    Vicent, Aug 25, 2003
    #1
    1. Advertising

  2. Vicent

    osmium Guest

    Vicent writes:

    > I work with C++ builder 3.0 and I need to read and process a text
    > file. I wonder what is the best tool to do it, the iostream library or
    > the stdio library.
    >
    > What´s the difference between them?


    The stdio library was designed for CO. The iostream library was designed
    for C++. The latter has type checking which is good. The stdio library is
    somewhat easier to learn, but since you are, presumably, headed for C++ as a
    destination, I think you should use the iostream library. Note that the C++
    language inherits *all* the C libraries, it changes the names of the header
    files but it is still the same old library lurking under the surface.
     
    osmium, Aug 25, 2003
    #2
    1. Advertising

  3. Vicent

    PT Guest

    > Vicent writes:
    >
    >> I work with C++ builder 3.0 and I need to read and process a text
    >> file. I wonder what is the best tool to do it, the iostream library or
    >> the stdio library.
    >>
    >> What's the difference between them?

    >
    > The stdio library was designed for CO. The iostream library was designed
    > for C++. The latter has type checking which is good. The stdio library is
    > somewhat easier to learn, but since you are, presumably, headed for C++ as a
    > destination, I think you should use the iostream library. Note that the C++
    > language inherits *all* the C libraries, it changes the names of the header
    > files but it is still the same old library lurking under the surface.


    Actually, there's also a difference in speed. If you need to write and/or
    read really large files (maybe even several gigabytes in size), then i'd
    recommend using stdio, not iostream, because stdio is faster.

    Also, formatting output (in tables, for instance) is, in my opinion,
    simpler in printf than using the corresponding iostream objects (cout).

    But outputting a simple text line is, of course, much easier with
    iostream.
     
    PT, Aug 25, 2003
    #3
    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. Joona I Palaste

    Re: Output without stdio.h or iostream

    Joona I Palaste, Jul 3, 2003, in forum: C Programming
    Replies:
    0
    Views:
    726
    Joona I Palaste
    Jul 3, 2003
  2. Lew Pitcher

    Re: Output without stdio.h or iostream

    Lew Pitcher, Jul 3, 2003, in forum: C Programming
    Replies:
    0
    Views:
    758
    Lew Pitcher
    Jul 3, 2003
  3. Malcolm

    Re: Output without stdio.h or iostream

    Malcolm, Jul 3, 2003, in forum: C Programming
    Replies:
    0
    Views:
    1,070
    Malcolm
    Jul 3, 2003
  4. Dan Pop

    Re: Output without stdio.h or iostream

    Dan Pop, Jul 4, 2003, in forum: C Programming
    Replies:
    0
    Views:
    384
    Dan Pop
    Jul 4, 2003
  5. Replies:
    18
    Views:
    1,934
    crazzybugger
    Oct 22, 2006
Loading...

Share This Page