User guide
3.3. GLOBAL FUNCTIONS 59
ch := rdch() CIN:y, POS:y, NAT:y
This call reads the next character from the currently selected input stream. If the
stream is ex haus te d, it returns the special value endstreamch. Input from the keyboard
is buffered until the ENTER (or RETURN) key is press ed to allow simple line editing
in which the backspace key may be used to de l et e the most recent character typed. See
Section 3.3.1 for more detailed information.
kind := rditem(v, upb) CIN:y, POS:y, NAT:y
This function is usually called from rdargs to read an item from the currently
selected input stream. After ignoring leading spaces and tabs, it packs the item into
the vector v whose upper bound is upb and returns an integer describing the kind of
item read. Table 3.5 gives t he kinds of item that can be read and corresponding item
codes.
Example items Kind of item Item code
= 5
; 4
carriage return 3
"from"
"*ntwo words*n" Quoted string 2
abc
123-45*6 Un quoted string 1
end-of-stream Terminator 0
An error -1
Figure 3.5: rditem results
Within quoted strings *n represents the newline character, *s represents a space,
** represents an asterisk and *" represents a double quote character.
n := readn() CIN:y, POS:y, NAT:y
This reads an optionally signed decimal integer from the currently selected input
stream. Leading spaces, tabs and newlines are ignored. If the number is syntactically
correct, it returns its value with result2 set to ze ro, otherwise it retur n s zero with
result2 se t to -1. In either case, it uses unrdch to replace the terminating character.
res := recordnote(scb) CIN:y, POS:y, NAT:y
This call returns the number of the record containing the character pointed to by
the file position pointer of stream scb. The record length must have already been set
by a call of setrecordlength. The result is -1 if the stream is not suitable.
res := recordpoint(scb, recno) CIN:y, POS:y, NAT:y
This call sets the file position pointer of stream scb to point to the first byte of the
record whose number is recno. The record length must have already been set by a call
of setrecordlength. It returns TRUE if successful and FALSE otherwise.