On 30/08/18 09:00, Henry Vermaak wrote:
On Thu, Aug 30, 2018 at 07:52:54AM +0200, Martin Schreiber wrote:

In order to flush textfiles automatically I use> ">  ttextrec(<thefile>).flushfunc:= 
ttextrec(<thefile>).inoutfunc;> "> after it is opened.

Reading text.inc this morning lead me to believe this is the correctway.  This 
is what the RTL does when opening serial devices inFileOpenFunc(), for example. 
 There's a comment inside Flush() that saysthat InOutFunc() should be used to 
flush, since the FlushFunc() may notbe assigned.

I've just checked this and unfortunately it doesn't do very much for the standard device (?) used by WriteLn() etc., i.e. as would be used for a quick-and-dirty program.

I've tried

    ttextrec(StdErr).flushfunc:= ttextrec(StdErr).inoutfunc;
//    Flush(StdErr);
    while true do begin
//      Flush(StdOut);                  // Has limited effect
      ttextrec(StdErr).flushfunc:= ttextrec(StdErr).inoutfunc;

and

program(input, output, error)

..
//    error.flushfunc:= error.inoutfunc;
//    Flush(StdErr);
    while true do begin
//      Flush(StdOut);                  // Has limited effect
      output.flushfunc:= output.inoutfunc;

(Is that latter form even valid any more?)

Please don't anybody put any effort into it- it's a very minor niggle from my POV.

--
Mark Morgan Lloyd
markMLl .AT. telemetry.co .DOT. uk

[Opinions above are the author's, not those of his employers or colleagues]
_______________________________________________
fpc-pascal maillist  -  fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal

Reply via email to