File/Stream Utilities

Author(s): The CLIP Group.

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

Usage and interface

Documentation on exports

PREDICATE

Usage 1:file_terms(File,Terms)

Unifies Terms with the list of all terms in File.

  • The following properties should hold at call time:
    (streams_basic:sourcename/1)File is a source name.
    (term_typing:var/1)Terms is a free variable.
  • The following properties should hold upon exit:
    (basic_props:list/1)Terms is a list.

Usage 2:file_terms(File,Terms)

Writes the terms in list Terms (including the ending '.') onto file File.

  • The following properties should hold at call time:
    (streams_basic:sourcename/1)File is a source name.
    (basic_props:list/1)Terms is a list.

PREDICATE

Usage:copy_stdout(File)

Copies file File to standard output.

  • The following properties should hold at call time:
    (term_typing:nonvar/1)File is currently a term which is not a free variable.
    (streams_basic:sourcename/1)File is a source name.

PREDICATE

Usage:file_to_string(FileName,String)

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

  • The following properties should hold at call time:
    (term_typing:nonvar/1)FileName is currently a term which is not a free variable.
    (term_typing:var/1)String is a free variable.
    (streams_basic:sourcename/1)FileName is a source name.
  • The following properties should hold upon exit:
    (basic_props:string/1)String is a string (a list of character codes).

PREDICATE

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.

  • The following properties should hold at call time:
    (term_typing:nonvar/1)FileName is currently a term which is not a free variable.
    (term_typing:var/1)String is a free variable.
    (streams_basic:sourcename/1)FileName is a source name.
  • The following properties should hold upon exit:
    (basic_props:string/1)String is a string (a list of character codes).

PREDICATE

Usage:string_to_file(String,FileName)

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

  • The following properties should hold at call time:
    (term_typing:nonvar/1)String is currently a term which is not a free variable.
    (term_typing:nonvar/1)FileName is currently a term which is not a free variable.
    (basic_props:string/1)String is a string (a list of character codes).
    (streams_basic:sourcename/1)FileName is a source name.

PREDICATE

Usage:stream_to_string(Stream,String)

Reads all the characters from Stream, returns them in String, and closes Stream.

  • The following properties should hold at call time:
    (term_typing:nonvar/1)Stream is currently a term which is not a free variable.
    (term_typing:var/1)String is a free variable.
    (streams_basic:stream/1)Stream is an open stream.
  • The following properties should hold upon exit:
    (basic_props:string/1)String is a string (a list of character codes).

PREDICATE

Usage:stream_to_string(Stream,String,Tail)

Reads all the characters from Stream, returns them in String, and closes Stream. Tail is the end of String

  • The following properties should hold at call time:
    (term_typing:nonvar/1)Stream is currently a term which is not a free variable.
    (term_typing:var/1)String is a free variable.
    (streams_basic:stream/1)Stream is an open stream.

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