Fix types and error handling in examples

In test_common.c:
- int and ssize_t was used for file sizes, thus it was impossible to have checkpoints larger than 2GB. Fixed.
- write_checkpoint returned the same value (0) both for success and error.

In test_api.c and test_common.c, more detailed error messages in case of errors.