[comp.lang.pascal] How to flush the buffer in non-text files

hofmeist@cantor.informatik.uni-dortmund.de (Thomas Hofmeister) (03/29/91)

This might be an FAQ, but nevertheless...

TP's procedure flush only works with text files.
How can I do a "flush" in a "file of something" without
doing a "close(file);open(file)" ?

Thanks in advance....

dmurdoch@watstat.waterloo.edu (Duncan Murdoch) (03/29/91)

In article <3130@laura.UUCP> hofmeist@cantor.informatik.uni-dortmund.de (Thomas Hofmeister) writes:
>
>This might be an FAQ, but nevertheless...
>
>TP's procedure flush only works with text files.
>How can I do a "flush" in a "file of something" without
>doing a "close(file);open(file)" ?

You don't need to - TP doesn't buffer other file types.  The flush() procedure
just flushes TP's buffers to DOS.  It doesn't commit the output to disk.

If you want to commit to disk, you need to use a DOS call.  The old DOS 2 trick
was to duplicate the file handle and close the duplicate.  There's a DOS 3.3+
service to commit to disk,  INT 21h with AX=68h, BX=file handle, but I don't
know if you'll want to limit yourself to 3.3+.

Duncan Murdoch