Can I flush a file

BlitzPlus Forums/BlitzPlus Programming/Can I flush a file

3DBuzzFan(Posted 2005) [#1]
I wonder if there is a command (or a way) in blitzplus to flush the file buffer.
Or maybe simply closing the file is enough for flushing the remaining not-yet-written data.
Thank you so much


rdodson41(Posted 2005) [#2]
Do you mean clear the file? If so you can just overwrite it using WriteFile().


3DBuzzFan(Posted 2005) [#3]
What I need is a way to make sure that the file has been written to disk.
I guess there is a disk-buffer in Blitz, which keeps track of all the bytes that have to be written to disk.
I think that when you write something to a file, it actualy gets written into that buffer instead.
Then, by the time this buffer gets full, all of its content is flushed into the actual disk.
That would be pretty smart.
BUT I need a way to make sure that the data has actualy been sent to the disk, even before the buffer gets full.
I need this because I am writting a very robust application, which needs to recover from power-failure.
Power-failures are critical in this application, because they tthey happen very often.

Thanks,

Rui


rdodson41(Posted 2005) [#4]
I think that if you just close a file all the data in the buffer is written to disk. But I see your problem, this would work but then you have open the file up again. I'm not sure if you can do a sort of WriteData() thing. You'll probably just have to close it and open it up again.