Command: write

Syntax

write <channel> {,<message>}

Description

Write text to a system output channel.

Parameters

Switches

Notes

The write command may only be used on channels opened for writing, i.e. those opened with modes w, a and rw.

If there are no output list items, an empty line will be written to <channel>, otherwise each output list grouping will constitute one output line. A grouping is a list of items enclosed within hairpins.

If the channel is binary (opened by open -li=<port>, e.g. the FireRender output channel), the output will be wrapped in Fire Hose Protocol packet(s) of type NET_PACKET_STRING. If this command is being executed in response to a client request on the channel and precedes a writefile command, typically used to send a file back to a browser, the text being written will be regarded as an http header statement. See an example below.

Examples

Open a text file, and write 3 lines of data to it.

open ch,-of=myfile.txt
write ch,'Line 1','Line 2','Line 3'
ch.close

Write one line of data to an open channel.

write ch, <"X has a value",x>

Write one line of data with formatted numeric values

write ch, <x,y,z>, -fmt="%8.2f %g %10.4e"

Write some http header information to the FireRender channel, followed by some image output.

write firerender_channel, 'Content-Type: image/jpeg'
write firerender_channel, 'Content-Disposition: inline; filename=example.jpg'
writefile firerender_channel,example.jpg

See Also

Commands:

close, open, writefile

Identifiers:

chan# (channel), firerender_*

Structures:

channel, channel.session