On Thu, Aug 30, 2018 at 07:52:54AM +0200, Martin Schreiber wrote: > On Wednesday 29 August 2018 17:01:54 Mark Morgan Lloyd wrote: > > I think I've seen this question asked before, my apologies if this was > > recently. > > > > I've got two programs intended to be functionally identical, one in Perl > > and the other in FPC. They read a unix-domain datagram, decode the > > message, and emit output; if this goes to a file then it's reasonable to > > monitor it using tail -f > > > > Perl has a variable that you can set to force output to be unbuffered, > > with the result that as soon as a message is output it's in the file in > > its entirety. > > > > Is there an equivalent for Pascal, or should I be using something like > > fpSync(stdout) at opportune times? > > 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 correct way. This is what the RTL does when opening serial devices in FileOpenFunc(), for example. There's a comment inside Flush() that says that InOutFunc() should be used to flush, since the FlushFunc() may not be assigned. Thanks for this, Martin. Henry _______________________________________________ fpc-pascal maillist - fpc-pascal@lists.freepascal.org http://lists.freepascal.org/cgi-bin/mailman/listinfo/fpc-pascal