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:get_line(S,L)
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(L)
Behaves like current_input(S), get_line(S,Line).
line(L) :- string(L). line(end_of_file).
Usage:read_string_to_end(Stream,String)
Reads in String all the characters from Stream until an EOF is found.
Usage:read_bytes_to_end(Stream,Bytes)
Reads in Bytes all the bytes from Stream until an EOF is found.
Usage:discard_to_end(Stream)
Reads in all the bytes from Stream until an EOF is found.
Usage:read_bytes(Stream,N,Bytes)
Reads in Bytes at most N bytes from Stream, or until an EOF is found.
Usage:copy_stream(InS,OutS,Copied)
Copies all bytes bytes (until EOF or error) from the InS stream into the OutS stream. The number of copied bytes is returned in Copied
Usage:write_string(Stream,String)
Writes String onto Stream.
Usage:write_string(String)
Behaves like current_input(S), write_string(S, String).
Usage:write_bytes(Stream,Bytes)
Writes Bytes onto Stream.
Usage:write_bytes(Bytes)
Behaves like current_input(S), write_bytes(S, Bytes).
Usage:file_to_string(FileName,String)
Reads all the characters from the file FileName and returns them in String.
Usage:string_to_file(String,FileName)
Reads all the characters from the string String and writes them to file FileName.
Usage:file_to_bytes(FileName,Bytes)
Reads all the bytes from the file FileName and returns them in Bytes.
Usage:bytes_to_file(Bytes,FileName)
Reads all the bytes from the bytes Bytes and writes them to file FileName.
Usage:open_input(FileName,InputStreams)
Usage:close_input(InputStreams)
Usage:open_output(FileName,OutputStreams)
Usage:close_output(OutputStreams)