[examples] use snprintf