How to flush file buffers or ensure reliable writes?


Joe User

When I do Print#, I do not want to buffer the data in the application.

I tried Len=0 on the Open statement. That results in an error, which comes
as no surprise given the documentation (help page).

Len=1 "works" insofar as there is no error. But I don't know if it is doing
what I intend.

Is there some way to flush the application buffer for a particular file
descriptor, other than closing and reopening the file?

Some applications and O/Ses have a flush statement or function or some file
operation that causes a flush, e.g. writing an EOF.

Extra credit....

Is there some way to flush O/S buffers for the file; that is, to initiate
(if not complete) writes to the disk?

That might be too much to ask ;-). Even closing the file does not always
accomplish that in some O/Ses. But some O/Ses provide functions for that
purpose (flushing O/S buffers), or at least they claim to.



Tim Williams

I don't have an answer for your question, but out of interest what's the
problem you're trying to fix ?


Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question