Previous: Output Data Formats, Up: Formatted Input/Output [Contents][Index]
Routines fread
and freadf
have a format string as their
first (for fread
) or second (for freadf
) argument. Each
next data value is read according to the next viable format entry in the
format string.
LUX accepts most legal C input format strings, but with some notable exceptions. LUX’s input format strings consist of whitespace (which matches that much or more whitespace), ordinary text, which must be matched by the next non-whitespace input, and format entries.
Ordinarily, each input value consists of the next string of
non-whitespace characters up to the next whitespace or until the
specified field width has been reached, so that whitespace does not
count against field width. However, if the /COUNTSPACES
keyword
is specified, then LUX does count whitespace against field width. This
format is suitable for reading data that is aligned on specific columns
but for which no field delimiters are present and for which some values
may be missing.
If the format contains explicit text to be matched but that text is not present in the expected position in the input, then an error is generated.
The differences between LUX input formats and C input formats are:
/COUNTSPACES
keyword is specified. In C and in LUX (in absence
of the /COUNTSPACES
keyword) whitespace does not count against
field width.
%S
, which reads non-newline characters, is not
available in C.
6#
, not available in standard C,
indicate that the preceding format must be used 6 times and the result
stored in a single array (if not suppressed through the *
modifier).
%u
(unsigned
integer).
L
is not supported in LUX.
%t
and %T
read data in sexagesimal
notation. This format is not available in C.
%z
reads complex numbers. This format is not
available in C.
• Input Format Types: | Specifying data types for input | |
• Input Format Examples: | Some examples of input formats |
Previous: Output Data Formats, Up: Formatted Input/Output [Contents][Index]