@Nicolas Dusart gave a great answer. Here is the same information but explained from a different context.
"Printing to the screen" can mean 2 things:
- EVENTUALLY printing to the screen. lazy evaluation is not a perfect analogy, but the theory is the same.
- IMMEDIATELY printing to the screen.
Now, when you call "print", the system intelligently interprets that as eventually. You can ask it to immediately print to the screen, however.
Why is this confusing behavior intelligent? Well, imagine you have all your Aunties over, and you want to serve them tea.
- When the first one asks for a cup, you have a choice of immediately running to the kitchen and making her a cup, or eventually running to the kitchen and making her a cup.
- When the last one asks for a cup, you have a choice of immediately running to the kitchen and making her a cup, or eventually running to the kitchen and making her a cup.
Despite the two questions being almost exactly the same, it makes sense to answer them completely differently. When making the tea, you only want to put water to boil once. And you only want to run to the kitchen once. Despite the fact that you want to hand out a cup of tea 3 times. (I have 3 aunts lol)
Now, because we aren't talking about running to the kitchen and fulfilling a remembered request, and instead we are talking about dealing with data in a buffer, we do not call this action remembering a request and immediately running to the kitchen, but instead we call it buffering and flushing.
So to answer your question explicitly (and to repeat exactly as our good friend said): "flush" means "immediately deal with data in a buffer". It is synonymous with "clear a buffer of its data".
The difference between these two meanings really blurs when we consider the case of buffering a request to fulfill later. As an engineer, I think that either meaning is a valid use of the term. As a computer science student, flush only means "clear a buffer" to me.
flush()
you pull the plug. – Chloramphenicol