|
|
read, f, var1, var2, ..., varN | reads the varI from file f |
read, var1, var2, ..., varN | reads the varI from keyboard |
read_n, f, var1, var2, ..., varN | read, skip non-numeric tokens |
rdline(f) | returns next line from file f |
rdline(f, n) | returns next n lines from file f |
sread, s, var1, var2, ..., varN | reads the varI from string s |
The data type and dimensions of the varI determine how the text is converted as it is read. The varI may be arrays, provided the arrays have identical dimensions. If the varI have length L, then the read is applied as if called L times, with successive elements of each of the varI read on each call.
The read function takes the prompt keyword to set the prompt string, which defaults to "read> ".
Both read and sread accept the format keyword. The format is a string containing conversion specifiers for the varI. The number of conversion specifiers should match the number of varI. If the varI are arrays, the format string is applied repeatedly until the arrays are filled.
Read format strings in Yorick have (nearly) the same meaning as the format strings for the ANSI standard C library scanf routine. In brief, a format string consists of: