writeq(Stream, Term) writes the Prolog term Term into the output stream Stream, quoting atoms which need quotes.