Stream utilities

Author(s): The Ciao Development Team.

This module implements a collection of predicates to read/write streams (or files) from/to several sources (lists of terms, strings, predicate output, etc.).

Usage and interface

Documentation on exports

PREDICATEread_to_end/2

Usage:read_to_end(Stream,String)

Reads in String all the characters from Stream until an EOF is found.

PREDICATEread_to_end/3

Usage:read_to_end(Stream,String,Tail)

Reads in the difference list String-Tail all the characters from Stream until an EOF is found.

PREDICATEget_line/2
get_line(Stream,Line)

Reads from Stream a line of text and unifies Line with it. The end of the line can have Unix [10] or Windows/DOS [13, 10] termination, which is not included in Line. At EOF, the term end_of_file is returned.

Usage:get_line(S,L)

PREDICATEget_line/1
get_line(Line)

Behaves like current_input(S), get_line(S,Line).

Usage:get_line(L)

REGTYPEline/1
A regular type, defined as follows:
line(L) :-
        string(L).
line(end_of_file).

write_string(Stream,String)

Writes String onto Stream.

Usage:write_string(Stream,String)

write_string(String)

Behaves like current_input(S), write_string(S, String).

Usage:write_string(String)

  • The following properties should hold at call time:
    (basic_props:string/1)String is a string (a list of character codes).

Usage:file_to_string(FileName,String)

Reads all the characters from the file FileName and returns them in String.

Usage:file_to_string(FileName,String,Tail)

Reads all the characters from the file FileName and returns them in String. Tail is the end of String.

Usage:string_to_file(String,FileName)

Reads all the characters from the string String and writes them to file FileName.

No further documentation available for this predicate. Meta-predicate with arguments: output_to_file(goal,?).

PREDICATEopen_input/2

Usage:open_input(FileName,InputStreams)

PREDICATEclose_input/1

Usage:close_input(InputStreams)

PREDICATEopen_output/2

Usage:open_output(FileName,OutputStreams)

Usage:close_output(OutputStreams)

Documentation on imports

This module has the following direct dependencies: