A The SWI-Prolog library
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • The SWI-Prolog library
        • library(aggregate): Aggregation operators on backtrackable predicates
        • library(ansi_term): Print decorated text to ANSI consoles
        • library(apply): Apply predicates on a list
        • library(assoc): Association lists
        • library(broadcast): Broadcast and receive event notifications
        • library(charsio): I/O on Lists of Character Codes
          • format_to_chars/3
          • format_to_chars/4
          • write_to_chars/2
          • write_to_chars/3
          • atom_to_chars/2
          • atom_to_chars/3
          • number_to_chars/2
          • number_to_chars/3
          • read_from_chars/2
          • read_term_from_chars/3
          • open_chars_stream/2
          • with_output_to_chars/2
          • with_output_to_chars/3
          • with_output_to_chars/4
        • library(check): Consistency checking
        • library(clpb): CLP(B): Constraint Logic Programming over Boolean Variables
        • library(clpfd): CLP(FD): Constraint Logic Programming over Finite Domains
        • library(clpqr): Constraint Logic Programming over Rationals and Reals
        • library(csv): Process CSV (Comma-Separated Values) data
        • library(dcg/basics): Various general DCG utilities
        • library(dcg/high_order): High order grammar operations
        • library(debug): Print debug messages and test assertions
        • library(dicts): Dict utilities
        • library(error): Error generating support
        • library(fastrw): Fast reading and writing of terms
        • library(gensym): Generate unique symbols
        • library(heaps): heaps/priority queues
        • library(increval): Incremental dynamic predicate modification
        • library(intercept): Intercept and signal interface
        • library(iostream): Utilities to deal with streams
        • library(listing): List programs and pretty print clauses
        • library(lists): List Manipulation
        • library(main): Provide entry point for scripts
        • library(nb_set): Non-backtrackable set
        • library(www_browser): Open a URL in the users browser
        • library(occurs): Finding and counting sub-terms
        • library(option): Option list processing
        • library(optparse): command line parsing
        • library(ordsets): Ordered set manipulation
        • library(pairs): Operations on key-value lists
        • library(persistency): Provide persistent dynamic predicates
        • library(pio): Pure I/O
        • library(portray_text): Portray text
        • library(predicate_options): Declare option-processing of predicates
        • library(prolog_debug): User level debugging tools
        • library(prolog_jiti): Just In Time Indexing (JITI) utilities
        • library(prolog_pack): A package manager for Prolog
        • library(prolog_xref): Prolog cross-referencer data collection
        • library(quasi_quotations): Define Quasi Quotation syntax
        • library(random): Random numbers
        • library(rbtrees): Red black trees
        • library(readutil): Read utilities
        • library(record): Access named fields in a term
        • library(registry): Manipulating the Windows registry
        • library(settings): Setting management
        • library(statistics): Get information about resource usage
        • library(strings): String utilities
        • library(simplex): Solve linear programming problems
        • library(solution_sequences): Modify solution sequences
        • library(tables): XSB interface to tables
        • library(terms): Term manipulation
        • library(thread): High level thread primitives
        • library(thread_pool): Resource bounded thread management
        • library(ugraphs): Graph manipulation library
        • library(url): Analysing and constructing URL
        • library(varnumbers): Utilities for numbered terms
        • library(yall): Lambda expressions
    • Packages

A.6 library(charsio): I/O on Lists of Character Codes

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.

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.

[det]format_to_chars(+Format, +Args, -Codes)
Use format/2 to write to a list of character codes.
[det]format_to_chars(+Format, +Args, -Codes, ?Tail)
Use format/2 to write to a difference list of character codes.
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.
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.
[det]atom_to_chars(+Atom, -Codes)
Convert Atom into a list of character codes.
deprecated
Use ISO atom_codes/2.
[det]atom_to_chars(+Atom, -Codes, ?Tail)
Convert Atom into a difference list of character codes.
[det]number_to_chars(+Number, -Codes)
Convert Atom into a list of character codes.
deprecated
Use ISO number_codes/2.
[det]number_to_chars(+Number, -Codes, ?Tail)
Convert Number into a difference list of character codes.
[det]read_from_chars(+Codes, -Term)
Read Codes into Term.
Compatibility
The SWI-Prolog version does not require Codes to end in a full-stop.
[det]read_term_from_chars(+Codes, -Term, +Options)
Read Codes into Term. Options are processed by read_term/3.
Compatibility
sicstus
[det]open_chars_stream(+Codes, -Stream)
Open Codes as an input stream.
See also
open_string/2.
[det]with_output_to_chars(:Goal, -Codes)
Run Goal as with once/1. Output written to current_output is collected in Codes.
[det]with_output_to_chars(:Goal, -Codes, ?Tail)
Run Goal as with once/1. Output written to current_output is collected in Codes\Tail.
[det]with_output_to_chars(:Goal, -Stream, -Codes, ?Tail)
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.