Next: Escape Codes, Previous: Data I/O Routines, Up: Input/Output [Contents][Index]
The format in which output is printed may be specified in various ways,
which broadly divide into two classes: those that find a format suitable
for the argument, and those that map the argument to fit the format.
The first class is used by routine type
and its aliases, as well
as by printf
, string
, and str
. The second class is
used by fprint
, fprintf
, and fstring
.
Input routines are similarly divided into two classes. Routines
read
and readf
read data depending on the argument type,
and routines fread
, freadf
, and freads
read data
according to a specified format.
To do any kind of formatted input or output, one must be able to specify the format that is to be used. LUX uses format specifications which are modeled on those from C, but with some modifications.
Format strings consist of ordinary text, format entries, and format groupings. All format entries are introduced by a percent sign (%) and must contain a specifier character (which indicates the type of data the format applies to). The simplest formats contain nothing more.
A general single format entry consists of the following components, in the indicated order:
%
)
.
)
#
)
See also: fprint, fprintf, fread, freadf, freads, fstring, printf, read, readf, str, string, type.
• Format Specifiers: | ||
• Format Modifiers: | ||
• Format Field Width: | ||
• Format Precision: | ||
• Format Grouping: | ||
• Long output lines: | ||
• In-Line Print Formats: | ||
• Output Data Formats: | ||
• Input Data Formats: |
Next: Escape Codes, Previous: Data I/O Routines, Up: Input/Output [Contents][Index]