• Places
    • Home
    • Graphs
    • Prefixes
  • Admin
    • Users
    • Settings
    • Plugins
    • Statistics
  • CPACK
    • Home
    • List packs
    • Submit pack
  • Repository
    • Load local file
    • Load from HTTP
    • Load from library
    • Remove triples
    • Clear repository
  • Query
    • YASGUI SPARQL Editor
    • Simple Form
    • SWISH Prolog shell
  • Help
    • Documentation
    • Tutorial
    • Roadmap
    • HTTP Services
  • Login

12.9 Foreign access to Prolog IO streams
AllApplicationManualNameSummaryHelp

  • Documentation
    • Reference manual
      • Foreign Language Interface
        • Foreign access to Prolog IO streams
          • Get IO stream handles
          • Creating an IO stream
          • Interacting with foreign streams
          • Foreign stream error handling
          • Foreign stream encoding
            • Ssetenc()
            • ScheckBOM()
            • SwriteBOM()
            • Scanrepresent()
          • Foreign stream line endings
          • Foreign stream position information
    • Packages
lags is a bitwise or of the constants below. These flags map to options for write_term/2.
PL_WRT_QUOTED
PL_WRT_IGNOREOPS
PL_WRT_NUMBERVARS
PL_WRT_PORTRAY
PL_WRT_CHARESCAPES
PL_WRT_NO_CHARESCAPES
The PL_WRT_NO_CHARESCAPES does not map to a write_term/2 option. If one of PL_WRT_CHARESCAPES or PL_WRT_NO_CHARESCAPES is specified, character escapes are (not) applied. If neither is specified the default depends, like for write/1, on the character_escapes flag on the module user.231Prior to version 9.1.6 the default (no flag) was to escape the quotes and the backslash (\).
PL_WRT_BACKQUOTED_STRING
PL_WRT_ATTVAR_IGNORE
PL_WRT_ATTVAR_DOTS
PL_WRT_ATTVAR_WRITE
PL_WRT_ATTVAR_PORTRAY
PL_WRT_BLOB_PORTRAY
PL_WRT_NO_CYCLES
PL_WRT_NEWLINE
PL_WRT_VARNAMES
PL_WRT_BACKQUOTE_IS_SYMBOL
PL_WRT_DOTLISTS
PL_WRT_BRACETERMS
PL_WRT_NODICT
PL_WRT_NODOTINATOM
PL_WRT_NO_LISTS
PL_WRT_RAT_NATURAL
PL_WRT_CHARESCAPES_UNICODE
PL_WRT_QUOTE_NON_ASCII
PL_WRT_PARTIAL

For example, to print a term to user_error as the toplevel does, use

    PL_write_term(Suser_error, t, 1200,
                  PL_WRT_QUOTED|PL_WRT_PORTRAY|
                  PL_WRT_VARNAMES|PL_WRT_NEWLINE)

12.9.4 Foreign stream error handling

int Sferror(IOSTREAM *s)
Returns TRUE if the stream is in an error condition, FALSE if the stream is valid and in normal condition and -1 if the stream is invalid.
void Sclearerr(IOSTREAM *s)
Clear the error state of a stream. This includes the end-of-file state, pending warnings and errors and timeout.
int Sseterr(IOSTREAM *s, int which, const char *message)
Set an error or warning state on the stream. The which argument is one of SIO_WARN or SIO_FERR. This

ClioPatria (version V3.1.1-42-gd6a756b-DIRTY)