If you don't need tight control, try atoi().
If you want tighter control of errors, prefer strtol().
Read the function descriptions!!!
Code:
char input1[] = "-c123";
char input2[] = "-c 123";
int val1atoi = atoi(input1 + 2);
int val2atoi = atoi(input2 + 2);
char *err;
errno = 0; int val1strtol = strtol(input1 + 2, &err, 10); /* test *err, val1strtol, and errno */
errno = 0; int val2strtol = strtol(input2 + 2, &err, 10); /* test *err, val2strtol, and errno */
You can also use sscanf() withy a littel more control than atoi() and a little less than strtol() ...
Code:
char input[] = "-c 123";
int val;
if (sscanf(input, "-c%d", &val) != 1) /* error */;
All 3 funtions above properly ignore whitespace.