Docs » Autodocs » dos.library » Flush
Flush -- Flushes buffers for a buffered filehandle (V36)
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).
fh - Filehandle to flush.
success - Success or failure.
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().
FPutC(), FGetC(), UnGetC(), Seek(), Close(), CreateNewProc(), SelectInput(), RunCommand()
|