8. Diagnostics
Prev | Chapter 9. The COMSTACK Module | Next

## 8. Diagnostics

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);

Prev | Up | Next
7. SSL | Home | 9. Summary and Synopsis