Some flushing method is needed for TFileStream
https://forum.lazarus.freepascal.org/index.php/topic,58619.msg436692.html#msg436692 This is rationale. Ie the reason for such a method.
TFileStream can be flushed on Win32 in Delphi: https://stackoverflow.com/questions/787019/how-to-flush-a-tfilestream
This method uses Win32 API function. So I suggest to add the virtual method to TFileStream (or TStream?) which will be implemented on Win32 (at least). Using Win32 API.
Alternative solution: change TJsonConfig.Flush like this:
procedure TJSONConfig.Flush;
....
if S<>'' then
begin
F.WriteBuffer(S[1],Length(S));
{$ifdef windows}
Windows.FlushFileBuffers(F.Handle);
{$endif}
end;
Edited by Alexey Torgashin