IF Computer > MINERVA > Manual > Reference > Predicates > Term Stream

Term Stream

MINERVA
ifcomputer logo
f
Expert Services on the Web

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),

document: http://www.ifcomputer.co.jp/MINERVA/Manual/Reference/Predicates/TermStream/print_de.html
published 2008/11/17 update 2002/3/20 (c) 1996-2006 IF Computer Japan
IF Computer 5-28-2 Sendagi, Bunkyo-ku Tel +81-3-5814-3352 start (AT) ifcomputer.com
Customer Support Tokyo 113-0022 Japan   http://www.ifcomputer.com
Back> managed with ubiCMS