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
            • Sferror()
            • Sclearerr()
            • Sseterr()
            • Sset_exception()
          • Foreign stream encoding
          • Foreign stream line endings
          • Foreign stream position information
    • Packages

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 causes PL_release_stream() to print a message (SIO_WARN) or raise an exception (SIO_FERR).
int Sset_exception(IOSTREAM *s, term_t ex)
Associate a Prolog exception term with the stream or clear the associated exception if ex is 0 and set/clear the SIO_FERR condition on the stream. If an exception is assocated PL_release_stream() raises this exception.