

This corresponds to "serialization/deserialization" in Java and other languages.
You CAN but shouldn't use this for reading input typed in by the user.
Example:
?- with_output_to(string(Buf),write_term(a(b,c,[1,2,3],var(ZZ)),[])), read_term_from_atom(Buf, T, []). Buf = "a(b,c,[1,2,3],var(_7256))", T = a(b, c, [1, 2, 3], var(_7848)).
Use readutil
for user querying:
https://www.swi-prolog.org/pldoc/man?section=readutil
Example:
format("Answer me!\n"), read_line_to_string(user_input,S1), string_lower(S1,S2), (member(S2,["yes","1","ok","y","ja","oui"]) -> format("OK!") ; (format("NOK"), fail)).
Answer me! |: YES OK!