How to write output to an external text file in addition to the standard output stream, i.e. a notebook for a session with FE and stdout for command-line session?
Asked
Active
Viewed 769 times
1 Answers
7
I expected this to work but it apparently only writes Print output:
AppendTo[
$Output,
OpenWrite["out.txt", FormatType -> OutputForm]
]
A workaround using $PrePrint:
output = OpenWrite["out.txt", FormatType -> OutputForm];
$PrePrint = (Write[output, #]; #) &;
Mr.Wizard
- 271,378
- 34
- 587
- 1,371
PutAppend[]and notOpenWrite[]? – user13253 Jun 20 '12 at 03:12OpenAppend? – Mr.Wizard Jun 20 '12 at 03:47