Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > C++ > iostream or stdio

Reply
Thread Tools

iostream or stdio

 
 
Vicent
Guest
Posts: n/a
 
      08-25-2003
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
 
Reply With Quote
 
 
 
 
osmium
Guest
Posts: n/a
 
      08-25-2003
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.


 
Reply With Quote
 
 
 
 
PT
Guest
Posts: n/a
 
      08-25-2003
> 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.

 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
exec() and sending to STDIO and reading from STDIO WinstonSmith_101@hotmail.com Java 18 10-22-2006 03:11 PM
Re: Output without stdio.h or iostream Dan Pop C Programming 0 07-04-2003 04:16 PM
Re: Output without stdio.h or iostream Malcolm C Programming 0 07-03-2003 06:25 PM
Re: Output without stdio.h or iostream Lew Pitcher C Programming 0 07-03-2003 03:08 PM
Re: Output without stdio.h or iostream Joona I Palaste C Programming 0 07-03-2003 02:56 PM



Advertisments