Availability:built-in
open_null_stream(--Stream)Open an output stream that produces no output. All counting functions 
are enabled on such a stream. It can be used to discard output (like 
Unix /dev/null) or exploit the counting properties. The 
initial encoding of Stream is utf8, enabling 
arbitrary Unicode output. The encoding can be changed to determine byte 
counts of the output in a particular encoding or validate if output is 
possible in a particular encoding. For example, the code below 
determines the number of characters emitted when writing Term.
write_length(Term, Len) :-
        open_null_stream(Out),
        write(Out, Term),
        character_count(Out, Len0),
        close(Out),
        Len = Len0.