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:
display(output, 3.0). % displays 3.0
set_stream(a,output), display(a,hi). % displays hi
[eclipse]: open(file1,update,S), display(S, X+2), close(S).
X = _72
S = 6
yes.
[eclipse]: sh('cat file1').
+(_98, 2)
yes.
Error:
display(S, a(b,c)). (Error 4).
display("string", a(b,c)). (Error 5).
display(9, X=2). (Error 192). % stream not open
display(atom, X=2). (Error 193).