- Documentation
- Reference manual
- Foreign Language Interface
- The Foreign Include File
- Argument Passing and Control
- Atoms and functors
- Analysing Terms via the Foreign Interface
- Constructing Terms
- Unifying data
- Convenient functions to generate Prolog exceptions
- Serializing and deserializing Prolog terms
- BLOBS: Using atoms to store arbitrary binary data
- Exchanging GMP numbers
- Calling Prolog from C
- Discarding Data
- String buffering
- Foreign Code and Modules
- Prolog exceptions in foreign code
- Catching Signals (Software Interrupts)
- Miscellaneous
- Errors and warnings
- Environment Control from Foreign Code
- Querying Prolog
- Registering Foreign Predicates
- Foreign Code Hooks
- Storing foreign data
- Embedding SWI-Prolog in other applications
- The Foreign Include File
- Foreign Language Interface
- Packages
- Reference manual
12.4.7 Serializing and deserializing Prolog terms
- int PL_put_term_from_chars(term_t t, int flags, size_t len, const char *s)
- Parse the text from the C-string s holding len
bytes and put the resulting term in t. len can be
(size_t)-1
, assuming a 0-terminated string. The flags argument controls the encoding and is currently one ofREP_UTF8
(string is UTF8 encoded),REP_MB
(string is encoded in the current locale) or 0 (string is encoded in ISO latin 1). The string may, but is not required, to be closed by a full stop (.).If parsing produces an exception the behaviour depends on the
CVT_EXCEPTION
flag. If present, the exception is propagated into the environment. Otherwise, the exception is placed in t and the return value isFALSE
.195TheCVT_EXCEPTION
was added in version 8.3.12.