next up previous contents index
Next: Primitive character I/O Up: Built-in predicates Previous: Switching Between Implicit and   Contents   Index

Status of streams

wait_for_input3+ListOfStreams, -ReadyList, +TimeOut Wait for input on one of the streams in ListOfStreams and return a list of streams on which input is available in ReadyList. wait_for_input3 waits for at most TimeOut seconds. Timeout may be specified as a floating point number to specify fractions of a second. If Timeout equals 0, wait_for_input3 waits indefinitely. This predicate can be used to implement timeout while reading and to handle input from multiple sources. The following example will wait for input from the user and an explicitly opened second terminal. On return, Inputs may hold user or P4 or both.


\begin{code}
?- open('/dev/ttyp4', read, P4),
wait_for_input([user, P4], Inputs, 0).
\end{code}

character_count2+Stream, -Count Unify Count with the current character index. For input streams this is the number of characters read since the open, for output streams this is the number of characters written. Counting starts at 0. line_count2+Stream, -Count Unify Count with the number of lines read or written. Counting starts at 1. line_position2+Stream, -Count Unify Count with the position on the current line. Note that this assumes the position is 0 after the open. Tabs are assumed to be defined on each 8-th character and backspaces are assumed to reduce the count by one, provided it is positive. fileerrors2-Old, +New Define error behaviour on errors when opening a file for reading or writing. Valid values are the atoms on (default) and off. First Old is unified with the current value. Then the new value is set to New.2.6


next up previous contents index
Next: Primitive character I/O Up: Built-in predicates Previous: Switching Between Implicit and   Contents   Index
Dr. Richard Botting 2001-12-12