[fpc-pascal] Unbuffering I/O

Henry Vermaak henry.vermaak at gmail.com
Thu Aug 30 13:51:50 CEST 2018


On Thu, Aug 30, 2018 at 10:57:21AM +0000, Mark Morgan Lloyd wrote:
> Ah yes, that's it, thanks very much.
> 
>       WriteLn(StdErr, Format('# Socket %s, clock resolution %8.6f uSec',
> [socketName, ts.tv_nsec / 1000]));
>     ttextrec(StdErr).flushfunc:= ttextrec(StdErr).inoutfunc;
>     while true do begin
>       ttextrec(Output).flushfunc:= ttextrec(Output).inoutfunc;
>       i := fprecv(client, @buff, 1024, 0);

You only need to set flushfunc once at startup (for standard handles) or
just after opening a file.  The whole output vs stdout thing has
confused me in the past, too.

Henry



More information about the fpc-pascal mailing list