success = Flush(fh)
D0 D1
LONG Flush(BPTR)
Flushes any pending buffered writes to the FileHandle. All buffered writes will also be flushed on
Close(). If the FileHandle was being used for input, it drops the buffer, and tries to
Seek() back to the last read position (so subsequent reads or writes will occur at the expected position in the file).
Before V37 release, Flush() returned a random value. As of V37, it always returns success (this will be fixed in some future release).
The V36 and V37 releases didn't properly flush filehandles which have never had a buffered IO done on them. This commonly occurs on redirection of input of a command, or when opening a file for input and then calling
CreateNewProc() with NP_Arguments, or when using a new FileHandle with
SelectInput() and then calling
RunCommand(). This is fixed in V39. A workaround would be to do
FGetC(), then
UnGetC(), then Flush().