Da:
http://www.cplusplus.com/ref/
Flush a stream.
If the given stream has been opened for writing operations the output buffer is phisically written to the file.
If the stream was open for reading operations the content of the input buffer is cleared.
The stream remains open after this call.
In pratica, se lo stream è di input, serve a cancellare l'eventuale input inserito dall'utente e non ancora letto dal programma; se lo stream e di output, il contenuto del buffer, scritto dal programma e non acora fisicamente scritto (ad esempio in un file a cui e collegato lo stream) viene scritto.