Have a look in the manual for the options in write_term.
It will do what you want.
Cheers
Bart Demoen
Disclaimer:
http://www.kuleuven.be/cwis/email_disclaimer.htm_______________________________________________
SWI-Prolog mailing list
SWI-Prolog@...
https://mailbox.iai.uni-bonn.de/mailman/listinfo.cgi/swi-prolog