Stefan,
I suggested this approach because I got the impression this program only writes
some messages every once a while, if this isn’t the case and the number of messages
to be written is substantial then your concerns are appropriate and the proposed
solution isn’t feasible
You may have to judge and go for a compromise then, i.e. only “flush the buffer”
by closing the workfile for important messages and keep it open for less severe /
informational messages.
There are other options, like piping the messages to another process which issues
unbuffered writes, but that’s probably overkill.
Best regards,
Wolfgang