[fpc-pascal] Unbuffering I/O

Henry Vermaak henry.vermaak at gmail.com
Wed Aug 29 17:49:28 CEST 2018


On Wed, Aug 29, 2018 at 03:01:54PM +0000, 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?

Does SetTextBuf() with a buffer of size 1 work?  I don't think there is
anything equivalent to setvbuf().  Otherwise you'll have to Flush() them
manually, which is a pain.

Henry



More information about the fpc-pascal mailing list