Add snprintf wrapper that checks the result