[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]


   NAME
        Flush -- Flushes buffers for a buffered filehandle (V36)

   SYNOPSIS
        success = Flush(fh)
        D0              D1

        long flush(bptr)

   FUNCTION
        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).

   INPUTS
        fh      - Filehandle to flush.

   RESULT
        success - Success or failure.

   BUGS
        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().

   SEE ALSO
        FputC(), fgetc(), ungetc(), seek(), close(), createnewproc(),
        selectinput(), runcommand()