next up previous
Next: Term Reading and Up: Built-In Predicates Previous: Status of Input

Primitive Character Input and Output

nl

  Write a newline character to the current output stream. On Unix systems nl/0 is equivalent to put(10) .
nl( +Stream)

  Write a newline to Stream.
put( +Char)

  Write Char to the current output stream, Char is either an integer-expression evaluating to an ASCII value () or an atom of one character.
put( +Stream, +Char)

  Write Char to Stream.
tab( +Amount)

  Writes Amount spaces on the current output stream. Amount should be an expression that evaluates to a positive integer (see section gif).
tab( +Stream, +Amount)

  Writes Amount spaces to Stream.
flush

  Flush pending output on current output stream. flush/0 is automatically generated by read/1 and derivates if the current input stream is user and the cursor is not at the left margin.
flush_output( +Stream)

  Flush output on the specified stream. The stream must be open for writing.
ttyflush

  Flush pending output on stream user. See also flush/0.
get0( -Char)

  Read the current input stream and unify the next character with Char. Char is unified with -1 on end of file.
get0( +Stream, -Char)

  Read the next character from Stream.
get( -Char)

  Read the current input stream and unify the next non-blank character with Char. Char is unified with -1 on end of file.
get( +Stream, -Char)

  Read the next non-blank character from Stream.
skip( +Char)

  Read the input until Char or the end of the file is encountered. A subsequent call to get0/1 will read the first character after Char.
skip( +Stream, +Char)

  Skip input (as skip/1) on Stream.
get_single_char( -Char)

  Get a single character from input stream `user' (regardless of the current input stream). Unlike get0/1 this predicate does not wait for a return. The character is not echoed to the user's terminal. This predicate is meant for keyboard menu selection etc.. If SWI-Prolog was started with the -tty flag this predicate reads an entire line of input and returns the first non-blank character on this line, or the ASCII code of the newline (10) if the entire line consisted of blank characters.



next up previous
Next: Term Reading and Up: Built-In Predicates Previous: Status of Input



Passani Luca
Tue Nov 14 08:58:33 MET 1995