Return Values and Errors

Quintus Prolog C functions return the following:

one of


true (1), false (0)
a pointer or null (0)

In some error situations, a global variable, QP_errno may also be set to give more information about the error condition.

Those I/O related predicates that take a Prolog stream argument do not set the error code in QP_errno. Instead, they set the errno field of the stream.

There are two QP_ functions provided to help diagnose error conditions from error numbers:

prints out a user message, together with a short error message describing the last error encountered that set QP_errno. This function is similar to the system function perror(3).
returns a pointer to the diagnostic message corresponding to a specified error number.

In addition, the error number is sometimes reported in the message field of exception terms, as in

     existence_error(Goal, _,_,_,errno(error number))

See mpg-ref-ove for a description of the conventions observed in the Reference Pages for Prolog predicates. C function Reference Pages differ primarily in the synopsis.