| Term streams are used to write/read to/from binary files
to hold MINERVA user data for compact storage and fast input/output.
Binary term streams are opened with open/4 with the option type(term).
After writing to a binary term stream it MUST be closed with an explicit call
of close/1.
Predicates
There are 2 predicates to write and read terms in binary form:
- write_binary_term(+TermStream, +Term)
writes a term to a TermStream
- read_binary_term(+TermStream, -Term)
reads a term from a TermStream
at end of file, returns end_of_file
Examples
open('mydata.data',write,TermStream,[type(term)]),
write_binary_term(TermStream, Term1),
:
write_binary_term(TermStream, TermN),
close(TermStream),
open('mydata.data',read,TermStream,[type(term)]),
repeat,
read_binary_term(TermStream, Term),
( Term = end_of_file ->
true
; doSomeThingWith(Term),
fail
), !,
close(TermStream),
|