c
char *endptr;
long temp = strtol(optarg, &endptr, 10);
if (endptr != optarg && *endptr == '\0' && temp > 0) {
    horizSubSampling = (int)temp;
} else {
    fprintf(stderr, "Error: Invalid horizontal subsampling value.\n");
    exit(1);
}
