A
A
artem782017-01-29 03:27:10
Delphi
artem78, 2017-01-29 03:27:10

How to write to a file without buffering in Delphi?

This code writes the lines to the file not at once, but in parts:

var
  f: textfile;
  i: integer;
begin
  AssignFile(f, 'file.txt');
  ReWrite(f);
  for i := 0 to 200 do
  begin
    WriteLn(f, 'string number ' + IntToStr(i));
    Sleep(1000);
  end;
  CloseFile(f);
end.

How to disable buffering. so that after each line the data is immediately saved to disk?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
V
Vapaamies, 2017-01-29
@artem78

Flush buffers with the Flush procedure .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question