[ Stream I/O | Reference Manual | Alphabetic Index ]

set_stream_property(+Stream, +Prop, +Value)

Sets the property Prop of the stream Stream to the value Value.
Stream
Stream handle or alias (atom)
Prop
Atom.
Value
atom, string, handle or integer.

Description

Used to set various stream properties:

    Prop            Value         Description

    compress        on, off       a hint for output operations (e.g.
                                  write_exdr/2) to use a more compact
                                  output format (output streams only).
                                  Default: on (file,pipe,socket) or off.

    delete_file     off,          delete an opened file automatically when:
                    when_lost,    - its stream handle becomes inaccessible
                    when_closed   - the stream is closed in any way

    encoding        octet,        character encoding used by this stream
                    iso_latin_1,
                    ...

    end_of_line     lf, crlf      which end-of-line sequence to write

    eof_action      eof_code,     how to react to end-of-file
                    error,        (input streams only)
                    reset

    event           atom or       event on writing to empty stream
                    event handle  (see open/4)

    flush           flush,        explicit or implicit flushing
                    end_of_line

    macro_expansion on, off       expand term macros (input streams only)

    offset          integer       current position in the
                                  stream, same as seek/2

    output_options  list          default output options for all term
                                  output on this stream. The list
                                  format is as in write_term/2,3.

    prompt          string        prompt string (input streams only)

    prompt_stream   handle        output stream for the prompt
                    or atom       (input streams only)

    sigio           on, off       enable/disable SIGIO signals on
                                  this stream (UNIX only)

    yield           on, off       yield on end-of-file (see open/4)

Modes and Determinism

Exceptions

(4) instantiation fault
Stream, Prop or Value is not instantiated.
(5) type error
Stream is neither an atom nor a stream handle.
(5) type error
Prop is instantiated, but not to an atom.
(5) type error
Value is of the wrong type for the given property.
(6) out of range
Prop is an atom, but not a settable property.
(6) out of range
Value is not recognised for the given property.
(193) illegal stream specification
Stream does not denote an open stream.

Examples

Success:
    set_stream_property(input, prompt, "hello: ").
    set_stream_property(Stream, flush, end_of_line).
    set_stream_property(Stream, end_of_line, crlf).

See Also

open / 3, open / 4, current_stream / 1, seek / 2, get_stream_info / 3, write_term / 2, write_term / 3