All predicatesShow sourcecharsio.pl -- I/O on Lists of Character Codes

This module emulates the Quintus/SICStus library charsio.pl for reading and writing from/to lists of character codes. Most of these predicates are straight calls into similar SWI-Prolog primitives. Some can even be replaced by ISO standard predicates.

Compatibility
- The naming of this library is not in line with the ISO standard. We believe that the SWI-Prolog native predicates form a more elegant alternative for this library.
Source format_to_chars(+Format, +Args, -Codes) is det
Use format/2 to write to a list of character codes.
Source format_to_chars(+Format, +Args, -Codes, ?Tail) is det
Use format/2 to write to a difference list of character codes.
Source write_to_chars(+Term, -Codes)
Write a term to a code list. True when Codes is a list of character codes written by write/1 on Term.
Source write_to_chars(+Term, -Codes, ?Tail)
Write a term to a code list. Codes\Tail is a difference list of character codes produced by write/1 on Term.
Source atom_to_chars(+Atom, -Codes) is det
Convert Atom into a list of character codes.
deprecated
- Use ISO atom_codes/2.
Source atom_to_chars(+Atom, -Codes, ?Tail) is det
Convert Atom into a difference list of character codes.
Source number_to_chars(+Number, -Codes) is det
Convert Atom into a list of character codes.
deprecated
- Use ISO number_codes/2.
Source number_to_chars(+Number, -Codes, ?Tail) is det
Convert Number into a difference list of character codes.
Source read_from_chars(+Codes, -Term) is det
Read Codes into Term.
Compatibility
- The SWI-Prolog version does not require Codes to end in a full-stop.
Source read_term_from_chars(+Codes, -Term, +Options) is det
Read Codes into Term. Options are processed by read_term/3.
Compatibility
- sicstus
Source open_chars_stream(+Codes, -Stream) is det
Open Codes as an input stream.
See also
- open_string/2.
Source with_output_to_chars(:Goal, -Codes) is det
Run Goal as with once/1. Output written to current_output is collected in Codes.
Source with_output_to_chars(:Goal, -Codes, ?Tail) is det
Run Goal as with once/1. Output written to current_output is collected in Codes\Tail.
Source with_output_to_chars(:Goal, -Stream, -Codes, ?Tail) is det
Same as with_output_to_chars/3 using an explicit stream. The difference list Codes\Tail contains the character codes that Goal has written to Stream.