- Documentation
- Reference manual
- Foreign Language Interface
- Foreign access to Prolog IO streams
- Interacting with foreign streams
- Sset_timeout()
- Sunit_size()
- Sputc()
- Sgetc()
- Sfgetc()
- Sungetc()
- Sputcode()
- Sgetcode()
- Speekcode()
- Sputw()
- Sgetw()
- Sfread()
- Sfwrite()
- Sfeof()
- Sfpasteof()
- Ssetlocale()
- Sflush()
- Ssize()
- Sseek()
- Sseek64()
- Stell()
- Stell64()
- Sclose()
- Sgcclose()
- Sfgets()
- Sgets()
- Sread_pending()
- Spending()
- Sfputs()
- Sputs()
- Sfprintf()
- SfprintfX()
- Sprintf()
- Svprintf()
- Ssprintf()
- Ssnprintf()
- SsnprintfX()
- Svsprintf()
- Svsnprintf()
- Sdprintf()
- SdprintfX()
- Svdprintf()
- Slock()
- StryLock()
- Sunlock()
- Sfileno()
- Swinsock()
- Sclosehook()
- Sset_filter()
- Ssetbuffer()
- Writing Prolog terms to foreign streams
- Interacting with foreign streams
- Foreign access to Prolog IO streams
- Foreign Language Interface
- Packages
- Reference manual
12.9.3.1 Writing Prolog terms to foreign streams
- int PL_write_term(IOSTREAM *s, term_t term, int precedence, int flags)
- Write term to s. precedence is the
initial operator precedence, typically 1200. flags is a
bitwise or of the constants below. These flags map to options for write_term/2.
PL_WRT_QUOTEDPL_WRT_IGNOREOPSPL_WRT_NUMBERVARSPL_WRT_PORTRAYPL_WRT_CHARESCAPESPL_WRT_NO_CHARESCAPES- The
PL_WRT_NO_CHARESCAPESdoes not map to a write_term/2 option. If one ofPL_WRT_CHARESCAPESorPL_WRT_NO_CHARESCAPESis specified, character escapes are (not) applied. If neither is specified the default depends, like for write/1, on the character_escapes flag on the moduleuser.242Prior to version 9.1.6 the default (no flag) was to escape the quotes and the backslash ().\ PL_WRT_BACKQUOTED_STRINGPL_WRT_ATTVAR_IGNOREPL_WRT_ATTVAR_DOTSPL_WRT_ATTVAR_WRITEPL_WRT_ATTVAR_PORTRAYPL_WRT_BLOB_PORTRAYPL_WRT_NO_CYCLESPL_WRT_NEWLINEPL_WRT_VARNAMESPL_WRT_BACKQUOTE_IS_SYMBOLPL_WRT_DOTLISTSPL_WRT_BRACETERMSPL_WRT_NODICTPL_WRT_NODOTINATOMPL_WRT_NO_LISTSPL_WRT_RAT_NATURALPL_WRT_CHARESCAPES_UNICODEPL_WRT_QUOTE_NON_ASCIIPL_WRT_PARTIAL
For example, to print a term to
user_erroras the toplevel does, usePL_write_term(Suser_error, t, 1200, PL_WRT_QUOTED|PL_WRT_PORTRAY| PL_WRT_VARNAMES|PL_WRT_NEWLINE)