strtol takes three arguments:
1) a string.
2) a base (can be zero for "automatic" -> anything starting with 0x is hex, starting with 0 -> octal, everything else is treated as decimal).
3) a pointer to a pointer to char for "where strtol stopped", which can be NULL if you don't care.
So to use it, we could do:
--Code:char *endPtr; long x; char str = "123456"; x = strtol(str, 0, &endPtr);