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

  • Home
  • SEARCH
  • 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 8503331
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 11, 20262026-06-11T01:43:45+00:00 2026-06-11T01:43:45+00:00

By definition taken from: http://www.cplusplus.com/reference/iostream/ostream/flush/ , it is not clear why the function exists,

  • 0

By definition taken from: http://www.cplusplus.com/reference/iostream/ostream/flush/ , it is not clear why the function exists, and for what purpose you would use it for. Why not call flush(), every time your write to the stream?

  • 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-06-11T01:43:47+00:00Added an answer on June 11, 2026 at 1:43 am

    In all likelihood, the word flush comes from exactly what you’d flush in real-life. A toilet…

    So let’s try a toilet analogy:

    Flushing every time a new one drops into the bowl is very time-consuming and a complete waste of water. That’s a big problem today where everyone’s trying to be environmentally friendly.

    So what do you do instead? You buffer it by saving it all up and flushing once at the end. If for whatever reason, you can always “prematurely” flush somewhere in the middle when you’re not done.


    C++ streams (among other things) work much the same way. To reduce overhead and improve performance, a stream buffers its contents and only periodically “flushes” it. The draw-back of this is that you may get “delayed” behavior like in this question: Why does printf not flush after the call unless a newline is in the format string?

    So that’s what flush() is for. To allow you to override the buffering.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

These are taken from the tuts-premium Jquery vid tutorials. http://tutsplus.com/lesson/the-this-keyword/ Jeff explains what 'this'
Why definition of std::function<>::operator() in the C++ standard is: R operator()(ArgTypes...) const; and not
There is a MySQL table which has this definition taken from SQLYog Enterprise :
How to I define the equivalent of this function (taken from learnyouahaskell ) inside
I have the following queue class (taken from wordpress): #include<iostream.h> class Queue { private:
Here's the code I'm trying to understand (it's from http://apocalisp.wordpress.com/2010/10/17/scalaz-tutorial-enumeration-based-io-with-iteratees/ ): object io {
The below definition is taken from Hibernate association mapping tutorial here Each book is
The definition of AudioBufferList looks weird to me… i guess my C is not
I have a function definition of the following form (within a large code): class
I'm getting the error referenced in the title from a file that doesn't reference

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.