Download Reference Manual
The Developer's Library for D
About Wiki Forums Source Search Contact

Stdout and tail

Moderators: kris

Posted: 07/27/08 16:46:39


I've just a weird behaviour, which I don't understand. I use Stdout to create a log file of a program. If I run the program I can see the messages on the console. But if I pipe the console messages into a file and then use tail -f to follow the messages, it takes ages until the messages are written into the file. I run a programm that needs about 25 minutes to calculate and I can't follow the output. It is displayed in big chunks after a while and after the program is stopped. Is there anything I need to configure? Is there anything I can do about it?



Some thoughts about switching from PHP to D:

Author Message

Posted: 07/27/08 19:22:07

Stdout and Cout detect when they are redirected to a file.

On those occasions, to optimize output, they do not flush on newline automatically.

You can override this by setting it explicitly at the beginning of the program with:

Stdout.flush = true;

And I think Cout is done with:

Cout.redirected = false;

They are separate flags, so if you use both, you must change both.


Posted: 07/28/08 08:49:48

Thank you very much Steve..


Some thoughts about switching from PHP to D: