You do not need current_stream/3 for that:
?- stream_property(X, file_no(2)). X = <stream>(0x7fe319340030).
| Did you know ... | Search Documentation: |
| Predicate current_stream/3 |
[deprecated]current_stream(?Object,
?Mode, ?Stream)[]
if the stream refers to some other object.
Mode is one of read or write.
This predicate is deprecated. New code should use the ISO predicate stream_property/2.
You do not need current_stream/3 for that:
?- stream_property(X, file_no(2)). X = <stream>(0x7fe319340030).
One awesome feature of this predicate is..
If user_error is somehow redirected. from set_prolog_IO/3
?- current_stream(2,write,ConsoleErr),format(ConsoleErr,'hi~n',[]).
Will find the real console error stream