SP_next_solution() #include <sicstus/sicstus.h>
int
SP_next_solution(SP_qid query);
Look for the next solution to the given query.
SP_open_query().
SP_SUCCESS for success, SP_FAILURE for failure,
SP_ERROR if an error condition occurred.
This will cause the Prolog engine to backtrack over any current
solution of an open query and look for a new one. The given argument
must be the innermost query that is still open, i.e. it must not
have been terminated explicitly by SP_close_query() or
SP_cut_query(). Only when the return value is
SP_SUCCESS are the values in the query arguments valid, and
will remain so until backtracking into this query or an enclosing one.
Finding Multiple Solutions of a Call.