
Patrick B. answered 05/24/19
Math and computer tutor/teacher
If you are writing the data to peripheral or external device like a printer, serial modem, internet socket, etc
where you are involved in the implementation and algorithm of the protocol, then yes flushing is a best practice.
Here is the general rule of them that solves most problem, written in the form of a rhyming poem......
" To keep the garbage from taking the lead,
always flush after each read."
IN other words, after each read operation, flush the output buffer (and vice versa)
after each write operation, flush the input buffer (and vice versa)