Documentation Prolog Predicate Reference builtin open/4

open/4

Open a source in a certain mode through a stream according to some options.

Description

open( +atom, +atom, -stream, +stream_options )

open(Source, Mode, Stream, Options) succeeds if Source can be open in the mode Mode through the stream Stream. Source can be an atom with the path to a file or an HTML object (see the dom module). Mode is an atom indicating the opening mode, namely, read, write or append. The append mode opens the file for writing, setting the stream at the end of the file. Stream can be either a variable, in which case it will be bound to an integer value identifying the stream, or an atom, in which case it will be used to identify the stream. The available values for Options can be checked in the next section.

Options

open accepts a list of options as its last argument. These options are:

If the Options list contains contradictory stream options, the rightmost stream option is the one which applies.

Implementation