iostream or stdio

V

Vicent

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
 
O

osmium

Vicent said:
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.
 
P

PT

Vicent said:
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.
 

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

No members online now.

Forum statistics

Threads
473,776
Messages
2,569,603
Members
45,189
Latest member
CryptoTaxSoftware

Latest Threads

Top