Next: Byte Data File Input Functions, Previous: The Close Function, Up: The File Library [Index]
Unless otherwise noted, functions evaluate -1 if nothing was read and the end of file was met.
integer f_case(file f, text &s);
reads the f file until the next zero character or until the files expires and sets s to the read result. The next read will start with the character just after the met zero.
is the length of s, -1 if nothing was read (end of file was met)
integer f_ever(file f, text c, text &s);
reads the f file for as long as the read characters do not belong to the c character set and sets s to the read result. The next read will start with the met in c character.
is the length of s, -1 if nothing was read (end of file was met)
integer f_fast(file f, text c, text &s);
reads the f file interpreting the C escape sequences for as long as the read unescaped characters do not belong to the c character set and sets s to the read result. The escaped characters are copied into the result. The next read will start with the met in c character.
is the length of s, -1 if nothing was read (end of file was met)
integer f_head(file f, text &s);
reads the f file interpreting the C escape sequences until the next new line character (the next unescaped new line character, that is) or until the files expires and sets s to the read result. The next read will start with the character just after the met (unescaped) new line.
is the length of s, -1 if nothing was read (end of file was met)
The backslash/new-line sequence is not interpreted as line continuation, it is interpreted as a new-line.
integer f_lead(file f, text &s);
reads the f file interpreting the C escape sequences until the next new line character (the next unescaped new line character, that is) or until the files expires and sets s to the read result. The next read will start with the character just after the met (unescaped) new line.
is the length of s, -1 if nothing was read (end of file was met)
The backslash/new-line sequence is interpreted as line continuation (and thus ignored), and not as a new-line.
integer f_line(file f, text &s);
reads the f file until the next new line character or until the files expires and sets s to the read result. The next read will start with the character just after the met new line.
is the length of s, -1 if nothing was read (end of file was met)
integer f_list(file f, list l, integer n);
reads the f file interpreting the C escape sequences until the next new line character (the next unescaped new line character, that is) or until the files expires and splits the read result into words in the l list. The next read will start with the character just after the met (unescaped) new line.
is the sum of the stored word lengths, -1 if nothing was read (end of file was met)
The backslash/new-line sequence is interpreted as line continuation (and thus ignored), and not as a new-line.
White space (space and tab character sequences) separates words.
The l list is cleared before any read, whether it renders strings to collect or it is the end of file. The read words are appended (as strings, data of the intrinsic ‘text’ type) to the list, in the order in which they are read.
If n is not zero, all but the first n - 1 read words are stored in the l list as a single string - the concatenation of these all but the first n - 1 with a single space character inserted in between two consecutive words.
cardinal f_msbfn(file f, integer n);
is the most significant byte first, binary, n bytes coded cardinal read from the f file
cardinal f_msbfvn(file f);
is the (most significant byte first) varint coded cardinal read from the f file. 7 bits in each read byte are picked up to form the value, with the most significant indicating whether the next byte should be read.
integer f_mind(file f, text c, text &s);
reads the f file interpreting the C escape sequences for as long as the read unescaped characters belong to the c character set and sets s to the read result. The escaped characters are copied into the result. The next read will start with the met not in c character.
is the length of s, -1 if nothing was read (end of file was met)
integer f_near(file f, text c, text &s);
reads the f file for as long as the read characters belong to the c character set and sets s to the read result. The next read will start with the met not in c character.
is the length of s, -1 if nothing was read (end of file was met)
integer f_news(file f, list l, integer n, integer bits, text separators);
reads the f file like f_list does. separators specifies the list of words separating characters. bits is a bitwise OR of flags further specifying the task.
‘f_list(f, l, n)’ and ‘f_news(f, l, n, 0, " \t")’ are equivalent.
is the sum of the stored word lengths, -1 if nothing was read (end of file was met)
integer f_peek(file f);
reads a character from the f file without removing it from the read buffer. The next read, if any, will start with the read character (just as if ‘f_peek’ was never called).
is the read character as a positive value, -1 if none was read
integer f_peep(file f, integer i);
reads the ith subsequent character from the f file without removing it from the read buffer. Calling ‘f_peep’ has no effect on subsequent reads. i needs to be positive and less than the read buffer size. ‘f_peek(f)’ and ‘f_peep(f, 0)’ are equivalent.
See Miscellaneous File Definitions.
is the read character as a positive value, -1 if none was read
integer f_pick(file f);
reads a character from the f file. The next read will start with the character just after the read one.
is the read character as a positive value, -1 if none was read
integer f_van(file f, cardinal &c);
sets c as the (most significant byte first) varint coded cardinal read from the f file. 7 bits in each read byte are picked up to form the value, with the most significant indicating whether the next byte should be read.
is the number of read bytes
integer f_word(file f, text &s);
skips any character until the first neither space nor tab, reads the f file until the first space, tab or next new line character or until the files expires and sets s to the read result. The next read will start with the met space, tab or new line character, except for when new line was met before reading any non space, tab or new line character, case in which the next read will start with the character after the met new line character.
is the length of s, -2 if new line was met before reading any non space, tab or new line character, -1 if nothing was read (end of file was met)
s will be the empty string for negative evaluations.
integer f_yank(file f);
reads a character from the f file. The next read will start with the character just after the read one. Unlike ‘f_pick(f)’ it does not admit short reads.
is the read character as a positive value
Next: Byte Data File Input Functions, Previous: The Close Function, Up: The File Library [Index]