[Lazarus] Cloning standard output to text file
Carlos E. R.
robin.listas at telefonica.net
Fri May 4 13:34:54 CEST 2018
On 2018-05-04 13:30, Bart via Lazarus wrote:
> On Fri, May 4, 2018 at 12:51 PM, Carlos E. R. via Lazarus
> <lazarus at lists.lazarus-ide.org> wrote:
>
>> I want to do a series of "writeln(...)" and have the output go
>> simultaneously to the console and to a text file of my choice. I have
>> the vague idea that this was done writing a text file handler :-?
>
> I once wrote a simple utility (myutil) that read from stdin, echoed to
> stdout and echoed to a logfile.
> I then used a pipe from the commandline to achieve what I wanted.
> E.g.:
>
> myprog | mytuil path/to/log
>
> Or something similar to that.
Yes, of course, that's what I'm doing now, but I wanted to do it
internally, control the file name, perhaps rotate it, etc :-)
Actually:
myprog | tee mytuil path/to/log
It has the effect that text to screen is written in chunks, may stop at
the middle of a line. So at the end each cycle, I issue a "flush(output);"
--
Cheers / Saludos,
Carlos E. R.
(from 42.3 x86_64 "Malachite" at Telcontar)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: OpenPGP digital signature
URL: <http://lists.lazarus-ide.org/pipermail/lazarus/attachments/20180504/287cd1f7/attachment.sig>
More information about the Lazarus
mailing list