GetCode2
Implements ISO's get_code/2: reads (consuming it) the next character code from the input stream identified by the first argument (an alias or $stream(...) term) and unifies it with the second, as -1 at end of stream.
Throws
if the first argument is unbound.
if it does not identify an open channel.
(stream_type) if it identifies an output channel instead.
Fails, rather than erroring, if the channel is closed.