I am aware that one can write to a terminal standard output like so:
WriteString["stdout","Some stuff","\r"];
Note here that I am using a carriage return on purpose, as part of some output monitoring. However, sometimes the output gets a bit messed up because it seems like stdout doesn't always update on the carriage return. I've seen this kind of thing before in C++ for example, and there I usually solve it by flushing the stdout stream. But I don't know how to do that, or anything analogous, in Mathematica. Help? :).
I am in a Linux environment, in case that matters.
math -run 'WriteString["stdout", 123]; Pause[5]; Quit[]') – Szabolcs Dec 19 '16 at 16:57math -run 'Table[Table[WriteString["stdout", "blah blah "<>ToString[i]<>" "<>ToString[j]<>" ","\r"],{i,1,10000}],{j,1,10000}]; Quit[]'. I am not sure what causes the issue in my larger code. Maybe it is even related to my exact terminal environment or something. I guess my question stands independently of the exact problem though :). – Ben Farmer Dec 20 '16 at 09:14wolframscript, the behaviour may be entirely different. I am not sure about the older script mode. – Szabolcs Dec 22 '16 at 12:35