All functions return -1 if an error occurs. Typically, the functions
will return 0 on success, but the data exchange functions
(cs_get, cs_put,
cs_more) follow special rules. Consult their
descriptions.
The error code for the COMSTACK can be retrieved using C macro
cs_errno which will return one
of the error codes CSYSERR,
CSOUTSTATE,
CSNODATA, ...
int cs_errno(COMSTACK handle);
You can the textual representation of the error code
by using cs_errmsg, which
works like strerror(3).
const char *cs_errmsg(int n);
It is also possible to get straight to the textual representation
without the error code, by using
cs_strerror.
const char *cs_strerror(COMSTACK h);
Additional information about the current error can be retrieved with
cs_get_error. The returned string is owned by the
COMSTACK and remains valid until the error is changed or the COMSTACK is
closed. If no additional information is available,
*details is set to null. The function also returns the
current error code.
int cs_get_error(COMSTACK h, const char **details);