delphibufferflushtfilestream

How to flush a TFileStream?


TFileStream provides buffered output, which is great in most cases, but in some cases (especially during debugging) it's nice to flush the buffer immediately. Thing is, I don't know of any way to do that except calling Free, which is kind of counterproductive.

Is there a better way to do it?


Solution

  • You need to flush the stream. Try:

     FlushFileBuffers(fs.Handle); 
    

    ? Did you see/try this?