12.3.38 SP_get_list_n_codes()


#include <sicstus/sicstus.h>

SP_get_list_n_codes(SP_term_ref term,
                    SP_term_ref tail,
                    size_t n,
                    size_t *w,
                    char *s);

Copies into s the encoded string representing the character codes in the initial elements of list term, so that at most n bytes are used. The number of bytes actually written is assigned to *w. tail is set to the remainder of the list. The array s must have room for at least n bytes.

Please note: The array s is never NUL-terminated. Any zero character codes in the list term will be converted to the overlong UTF-8 sequence 0xC0 0x80.



The SP_term_ref holding the code-list


The SP_term_ref to be assigned the remainder of the list


Max number of bytes to use


Location to assign to number of bytes actually used


The location to assign to the encoded string

Return Value

Zero if the conversion fails (as far as failure can be detected), and a nonzero value otherwise.

See Also

Accessing Prolog Terms.

Send feedback on this subject.