Next: , Previous: , Up: Formatted Input/Output   [Contents][Index]

4.3.8 Output Data Formats

fprint, fprintf, and fstring have a format string as their first argument (or second in the case of fprintf). Each next argument is mapped to fit the data type requested by the next format entry in the format string. The last format entry is repeated as needed to service all arguments (if there are more arguments than format entries). There is no implied newline printed after treatment of the argument list: A second fprint starts printing where the first one left off.

There is one format entry per argument, so all elements of an array are printed with the same format entry. String arguments coupled with a number format are printed as 0. Number arguments coupled with a string format are not printed.

LUX accepts most legal C format strings. LUX format strings consist of ordinary text, interspersed with format entries, which are made up of a percent sign (%), a modifier, the minimum field width, a period (.), the precision, and the argument type. All but the percent sign and the argument type are optional. C escape sequences like \n are handled properly (Escape Codes).

Each format entry comprises some plain text, a %-specification, or a %-specification with some following plain text, depending on the details of the %-specification.

The main differences between the LUX format strings and the C format strings are that LUX but not C features the %J, %T, %S, and %z formats and _ and = format modifiers, and that C but not LUX features %n, %c, and %p formats.

See also: Formatted Input/Output

Next: , Previous: , Up: Formatted Input/Output   [Contents][Index]