Question and Answer Database FAQ1926D.txt Flush binary file from disk cache to disk Category :Object Pascal Platform :All Product :All 32 bit Question: How can I guarantee that information I have written to a binary file is flushed from the disk cache and actually written to the disk? Answer: The following example demonstrates flushing the disk cache of given binary file, so that data is guaranteed to be written to the disk. Example: procedure TForm1.Button1Click(Sender: TObject); var f : file; i : integer; begin i := 10; AssignFile(f, 'C:\DownLoad\Test.Bin'); ReWrite(f, 1); BlockWrite(f, i, sizeof(i)); FlushFileBuffers(TFileRec(f).Handle); CloseFile(f); end; 7/16/98 4:31:28 PM
Last Modified: 01-SEP-99