contents.gifprev1.gifnext1.gif

WRITE_FILE

Description:

The buffer or range to write as a file is passed as the first parameter. The file to write to is passed as the second parameter. If the optional second parameter is not present, then the text is written to the buffer output file. If the filename is not passed and the buffer has no predefined output file, the filename is prompted for. If no filename is provided at the prompt, the buffer is not written.

Syntax:

string := WRITE_FILE ( {buffer | range} )

string := WRITE_FILE ( {buffer | range}, file-name-string )

Example:

The following writes the contents of the current buffer (as defined by the nu/TPU built-in CURRENT_BUFFER) to a file.

WRITE_FILE ( CURRENT_BUFFER )

Errors:

TPU$_CLOSEOUT Opened, read, but couldn't CLOSE file.

TPU$_CONTROLC Execution aborted by [CTRL-C].

TPU$_NOFILEACCESS Cannot access new file.

TPU$_OPENOUT Could not open WRITE file.

TPU$_WRITEERR Opened but could not WRITE file.

Related Builtins:

CREATE_BUFFER

EXIT

READ_FILE