|
SYNOPSIS
<WRITE [APPEND] $file>
... output to file ...
</WRITE>
DESCRIPTION The WRITE statement redirects the output generated inside its
block to the given $file, truncating if it exists. If the
APPEND flag is given, the file is appended to instead of
truncated.
In version 4.00.1004670000 20011101 and later, the $file
argument may be an empty string for output to be discarded (ie.
/dev/null or NUL redirect); ``-'' (single dash)
to denote stdout (ie. no-op); or ``--'' (two dashes) to denote
top-level stdout (ie. ``break through'' all outer <CAPTURE>,
<WRITE> etc. and print to output).
DIAGNOSTICS
WRITE has no effect on $ret.
EXAMPLE This function appends a log message ($logmsg) to a log file:
<A NAME=logmsg>
<WRITE APPEND /tmp/log.txt>
<fmt "%t %s\n" "now" $logmsg>
</WRITE>
</A>
CAVEATS The WRITE statement was added in version 2.1.901600000 19980728.
While the output of WRITE is buffered, simultaneous writes to
the same file by different processes is discouraged, as there is no
guarantee any process's data will be completely written before the
others'.
SEE ALSO
read, READLN
Copyright © Thunderstone Software Last updated: Wed Aug 6 11:57:09 EDT 2008
|