Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 759469
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T15:36:02+00:00 2026-05-14T15:36:02+00:00

As you all know there are libraries using streams such as iostream and fstream

  • 0

As you all know there are libraries using streams such as iostream and fstream.

My question is:

  • Why streams? Why didn’t they stick with functions similar to print, fgets and so on (for example)?

They require their own operators << and >> but all they do could be implemented in simple functions like above, also the function

printf("Hello World!");

is a lot more readable and logical to me than

cout << "Hello World";

I also think that all of those string abstractions in C++ all compile down to (less efficient) standard function calls in binary.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-14T15:36:02+00:00Added an answer on May 14, 2026 at 3:36 pm

    Streams have better type safety.

    For instance printf("%s", a); can go horribly wrong if a is an integer. cout << a; doesn’t have this problem.

    Another issue is that streams better conform to Object Oriented design methodologies.

    For instance you have a simple application that writes some output and then you want the output to go to a file instead of to the console. With C calls you’ll have to replace all of the calls to printf to calls to fprintf and take care to maintain the FILE* along the way. With streams you just change the concrete class of the stream you’re using and that’s it, most of the code remains the same like so:

    void doSomething(ostream& output)
    {
       output << "this and that" << a;
    }
    
    doSomething(cout);
    doSomething(ofstream("c:\file.txt"));
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First of all, I know there are a few quite similar questions here on
We all know that most applications out there assume class names to follow the
First of all: I do know that there are already many questions and answers
All right, do not get angry now, I know there are several questions about
I know that there are lot's of questons on this, but all seem to
Does anyone know if there's a short-hand or convient way of disabling all of
I want to know if there is any way to fix all the PEP-8
I want to know if there's any way to update from all versions (Example:
There seems to be too many attributes/parameters in CSS... I want to know all
All I want to know is if there's an easy way to add lines

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.