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:
char str = "123456";
x = strtol(str, 0, &endPtr);
Cool, thanks. So I can simply test that the pointer is NULL before incrementing the count.
I don't think that you can check that the pointer itself is NULL -- you'll always get a real pointer back. You need to check that the pointer points to a null character (i.e. \0).