If you crash the system later, you know at least that much is guaranteed to be there on disk waiting for you when you reboot.
When you flush a socket, it pushes every last byte you have written so far out the wire, even if it means sending a tiny packet.
When you flush a console, flush guarantees every byte you have written so far is displayed on screen.
Many constructors have an autofush boolean so that, when true, flushes automatically after every write.
flush is analogous to flushing a toilet. It clears the bowl/buffer of accumulated waste/bytes.
You don’t need to flush just prior to close because close handles the flushing.
The catch is flush does not necessarily get all your data on disk. You watch a file being written with flush, and as far as dir is concerned, it stays 0 bytes long. To force what amounts to a close/reopen to ensure your data is on disk in case of a crash, do this periodically.
This page is posted |
http://mindprod.com/jgloss/flush.html | |
Optional Replicator mirror
|
J:\mindprod\jgloss\flush.html | |
Please read the feedback from other visitors,
or send your own feedback about the site. Contact Roedy. Please feel free to link to this page without explicit permission. | ||
Canadian
Mind
Products
IP:[65.110.21.43] Your face IP:[18.117.188.23] |
| |
Feedback |
You are visitor number | |