Element: channel.format

Type

 string

Description

The format used when writing data to channel. The rules for the format string are those for C Language "printf" statements. If no format has been defined for a channel, than data items are concatenated on an output line using the appropriate delimitation, defined by the channel.delimiter element.

Numeric values may be formatted using any of the various decimal conversion characters, e.g. d, i, o, e, f, g, x.

Point values are output as three numerics.

Any output items without a corresponding conversion field in the format will reuse the last conversion field.

This element is valid only for channels open for write.

Examples

string s = 'Values:'
numeric x = pi, h = 65
point p = (66,99,123.7)
open ch,-of=myfile.dat,w
ch.format = "-%s %8.5f %g %g %9.3e 0x%04x-"
write ch,<s,x,p>
close ch

The above will produce the following output file contents:

-Values: 3.14159 66 99 1.237e+02 0x0041-