ex26.pp 671 B

12345678910111213141516171819202122
  1. Program Example26;
  2. { Program to demonstrate the Flush function. }
  3. Var F : Text;
  4. begin
  5. { Assign F to standard output }
  6. Assign (F,'');
  7. Rewrite (F);
  8. Writeln (F,'This line is written first, but appears later !');
  9. { At this point the text is in the internal pascal buffer,
  10. and not yet written to standard output }
  11. Writeln ('This line appears first, but is written later !');
  12. { A writeln to 'output' always causes a flush - so this text is
  13. written to screen }
  14. Flush (f);
  15. { At this point, the text written to F is written to screen. }
  16. Write (F,'Finishing ');
  17. Close (f); { Closing a file always causes a flush first }
  18. Writeln ('off.');
  19. end.