:- use_module(library(iostream)).(can be autoloaded)
- Set stream to encoding Enc.
Without loaded plugins, the open_any/5
processes the following values for Specification. If no rule
processes Specification as
- A plain stream handle. Possisible post-processing options such as encoding are applied. Close does not close the stream, but resets other side-effects such as the encoding.
- Same as a plain Stream.
- If Specification is of the form =file://...=, the pointed to
file is opened using open/4.
library(uri)to be installed.
- Explicitly open the file Path. Path can be an Path(File) term as accepted by absolute_file_name/3.
- Open a Prolog string, atom, list of characters or codes as an input stream.
The typical usage scenario is given in the code below, where <process> processes the input.
setup_call_cleanup( open_any(Spec, read, In, Close, Options), <process>(In), Close).
Currently, the following libraries extend this predicate:
- Adds support for URLs using the