-
The basic code below is able to write a term to a file, but cannot read it back in. :- use_module(library(format)).
run :-
File = "term.txt",
Term = myStructure(a1, a2),
Options = [],
open(File, write, Stream1),
write_term(Stream1, Term, Options),
close(Stream1),
open(File, read, Stream2),
read_term(Stream2, Term2, Options),
close(Stream2),
format("Term2 = ~w~n", [Term2]). |
Beta Was this translation helpful? Give feedback.
Answered by
mthom
Jul 27, 2023
Replies: 1 comment 4 replies
-
|
Beta Was this translation helpful? Give feedback.
4 replies
Answer selected by
mvolkmann
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
read_term
expects the term insideterm.txt
to be terminated with a period as inmyStructure(a1, a2).
.