Note that as usual, the output is buffered, so it may need to be flushed either by closing the stream, by writing again or by using flush/1.
Success: [eclipse]: writeq(output, "string"),nl(output), > writeq(output, head:-body). "string" head :- body yes. [eclipse]: writeq(*(^(1,2),+(3,4))). 1 ^ 2 * (3 + 4) yes. Error: writeq(S, a(b,c)). (Error 4). writeq("string", a(b,c)). (Error 5). writeq(9, X + 2). (Error 192). writeq(atom, X + 2). (Error 193).