next up previous contents index
Next: Term reading and writing Up: Built-in predicates Previous: Status of streams   Contents   Index

Primitive character I/O

See chars for an overview of supported character representations.

nl0 Write a newline character to the current output stream. On Unix systems nl0 is equivalent to put(10). nl1+Stream Write a newline to Stream. put1+Char Write Char to the current output stream, Char is either an integer-expression evaluating to an ASCII value ( $0 \leq \arg{Char} \leq 255$) or an atom of one character. put2+Stream, +Char Write Char to Stream. put_byte1+Byte Alias for put1. put_byte2+Stream, +Byte Alias for put2 put_char1+Char Alias for put_char1. put2+Stream, +Char Alias for put2 put_code1+Code Alias for put1. put_code2+Stream, +Code Alias for put2 tab1+Amount Writes Amount spaces on the current output stream. Amount should be an expression that evaluates to a positive integer (see arith). tab2+Stream, +Amount Writes Amount spaces to Stream. flush_output0 Flush pending output on current output stream. flush_output0 is automatically generated by read1 and derivatives if the current input stream is user and the cursor is not at the left margin. flush_output1+Stream Flush output on the specified stream. The stream must be open for writing. ttyflush0 Flush pending output on stream user. See also flush_output[0,1]. get_byte1-Byte Read the current input stream and unify the next byte with Byte (an integer between 0 and 255. Byte is unified with -1 on end of file. get_byte2+Stream, -Byte Read the next byte from Stream. get_code1-Code Read the current input stream and unify Code with the character code of the next character. Char is unified with -1 on end of file. See also get_char1. get_code2+Stream, -Code Read the next character-code from Stream. get_char1-Char Read the current input stream and unify Char with the next character as a one-character-atom. See also atom_chars2. On end-of-file, Char is unified to the atom end_of_file. get_char2+Stream, -Char Unify Char with the next character from Stream as a one-character-atom. See also get_char2, get_byte2 and get_code2. get01-Char Edinburgh version of the ISO get_byte1 predicate. get02+Stream, -Char Edinburgh version of the ISO get_byte2 predicate. get1-Char Read the current input stream and unify the next non-blank character with Char. Char is unified with -1 on end of file. get2+Stream, -Char Read the next non-blank character from Stream. peek_byte1-Byte Reads the next input byte like get_byte1, but does not remove it from the input stream. peek_byte2+Stream, -Byte Reads the next input byte like get_byte2, but does not remove it from the stream. peek_code1-Code Reads the next input code like get_code1, but does not remove it from the input stream. peek_code2+Stream, -Code Reads the next input code like get_code2, but does not remove it from the stream. peek_char1-Char Reads the next input character like get_char1, but does not remove it from the input stream. peek_char2+Stream, -Char Reads the next input character like get_char2, but does not remove it from the stream. skip1+Char Read the input until Char or the end of the file is encountered. A subsequent call to get01 will read the first character after Char. skip2+Stream, +Char Skip input (as skip1) on Stream. get_single_char1-Char Get a single character from input stream `user' (regardless of the current input stream). Unlike get01 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 option 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. at_end_of_stream0 Succeeds after the last character of the current input stream has been read. Also succeeds if there is no valid current input stream. at_end_of_stream1+Stream Succeeds after the last character of the named stream is read, or Stream is not a valid input stream. copy_stream_data3+StreamIn, +StreamOut, +Len Copy Len bytes from stream StreamIn to StreamOut. copy_stream_data2+StreamIn, +StreamOut Copy data all (remaining) data from stream StreamIn to StreamOut.


next up previous contents index
Next: Term reading and writing Up: Built-in predicates Previous: Status of streams   Contents   Index
Dr. Richard Botting 2001-12-12