Availability:built-in
- alias(Atom)
- If Atom is bound, test if the stream has the specified alias. Otherwise unify Atom with the first alias of the stream.bugBacktracking does not give other aliases.
- buffer(Buffering)
- SWI-Prolog extension to query the buffering mode of this stream.
Buffering is one of
full
,line
orfalse
. See also open/4. - buffer_size(Integer)
- SWI-Prolog extension to query the size of the I/O buffer associated to a stream in bytes. Fails if the stream is not buffered.
- bom(Bool)
- If present and
true
, a BOM (Byte Order Mark) was detected while opening the file for reading, or a BOM was written while opening the stream. See section 2.19.1.1 for details. - close_on_abort(Bool)
- Determine whether or not abort/0 closes the stream. By default streams are closed.
- close_on_exec(Bool)
- Determine whether or not the stream is closed when executing a new
process (exec() in Unix, CreateProcess() in Windows). Default is to
close streams. This maps to fcntl()
F_SETFD
using the flagFD_CLOEXEC
on Unix and (negated)HANDLE_FLAG_INHERIT
on Windows. - encoding(Encoding)
- Query the encoding used for text. See section 2.19.1 for an overview of wide character and encoding issues in SWI-Prolog.
- end_of_stream(E)
- If Stream is an input stream, unify E with one of
the atoms
not
,at
orpast
. See also at_end_of_stream/[0,1]. - eof_action(A)
- Unify A with one of
eof_code
,reset
orerror
. See open/4 for details. - file_name(Atom)
- If Stream is associated to a file, unify Atom to the name of this file.
- file_no(Integer)
- If the stream is associated with a POSIX file descriptor, unify
Integer with the descriptor number. SWI-Prolog extension used
primarily for integration with foreign code. See also Sfileno() from
SWI-Stream.h
. - input
- True if Stream has mode
read
. - locale(Locale)
- True when Locale is the current locale associated with the stream. See section 4.23.
- mode(IOMode)
- Unify IOMode to the mode given to open/4
for opening the stream. Values are:
read
,write
,append
and the SWI-Prolog extensionupdate
. - newline(NewlineMode)
- One of
posix
ordos
. Ifdos
, text streams will emit\r\n
for\n
and discard\r
from input streams. Default depends on the operating system. - nlink(-Count)
- Number of hard links to the file. This expresses the number of `names'
the file has. Not supported on all operating systems and the value might
be bogus. See the documentation of fstat() for your OS and the value
st_nlink
. - output
- True if Stream has mode
write
,append
orupdate
. - position(Pos)
- Unify Pos with the current stream position. A stream position is an opaque term whose fields can be extracted using stream_position_data/3. See also set_stream_position/2.
- reposition(Bool)
- Unify Bool with true if the position of the stream can be set (see seek/4). It is assumed the position can be set if the stream has a seek-function and is not based on a POSIX file descriptor that is not associated to a regular file.
- representation_errors(Mode)
- Determines behaviour of character output if the stream cannot represent
a character. For example, an ISO Latin-1 stream cannot represent
Cyrillic characters. The behaviour is one of
error
(throw an I/O error exception),prolog
(write\...\
escape code) orxml
(write&#...;
XML character entity). The initial mode isprolog
for the user streams anderror
for all other streams. See also section 2.19.1 and set_stream/2. - timeout(-Time)
- Time is the timeout currently associated with the stream. See
set_stream/2
with the same option. If no timeout is specified,
Time is unified to the atom
infinite
. - type(Type)
- Unify Type with
text
orbinary
. - tty(Bool)
- This property is reported with Bool equal to
true
if the stream is associated with a terminal. See also set_stream/2. - write_errors(Atom)
- Atom is one of
error
(default) orignore
. The latter is intended to deal with service processes for which the standard output handles are not connected to valid streams. In these cases write errors may be ignored onuser_error
.