Introduction
Flushing and buffering help control when data is actually sent out or saved. This makes programs faster and more efficient.
When you want to make sure a message appears immediately on the screen.
When writing data to a file and you want to save it right away.
When sending data over a network and need it sent without delay.
When you want to improve performance by grouping many small writes together.
When debugging and you want to see output before the program ends.