Actuallly "> filename" also appends the output of a command to a specified
file, except when the file has not yet been opened -- when it has not been
written previously in the AMPL session. In that case "> filename" causes
the file to be overwritten.
Bob Fourer
4...@ampl.com
option log_file >> ("foo.txt");
option log_file >> "foo.txt";
option log_file >> foo.txt;
In the first of these, you can use any AMPL string expression in place of
"foo.txt" inside the parentheses. Note that these will only append the output
from the "option log_file" command to file foo.txt, however. If you want to
append output of other commands, you will have to follow them with ">> ..." as
well. If you just want to define a log file to which all results of AMPL
commands are written, then don't use >> in the option log_file statement:
option log_file ("foo.txt");
option log_file "foo.txt";
option log_file foo.txt;
You may need to give the command "close foo.txt" at the end of your AMPL
session to ensure that all output is flushed from buffers to the log file.
Bob Fourer
4...@ampl.com
> -----Original Message-----
> From: am...@googlegroups.com [mailto:am...@googlegroups.com]
> On Behalf Of Jacob JKW
> Sent: Thursday, June 19, 2008 5:57 AM
> To: AMPL Modeling Language
Results are always appended to an active log file, until the file is closed or
the session is ended.
I should have mentioned that to explicitly close a log file, you should issue
two commands like:
option log_file '';
close foo.txt;
Otherwise AMPL will automatically re-open a blank file named foo.txt after the
previous foo.txt is closed. Fortunately you don't need to use "close" unless
output to the end of your log file is getting lost when you close your session.