long strtol( const char *str, char **endptr, int base )

unsigned long strtoul( const char *s, char **endptr, int radix )
- prototype in string.h
- converts string str to long (or unsigned long) value
- stops reading at first character that cannot be interpreted
as part of a long value, returning in *endptr
- str must have format:
[ws][sn][0][x][ddd]
where [ws] = optional whitespace
[sn] = optional sign (+-)
[0] = optional zero
[x] = optional x or X
[ddd] = optional digits
- base is between 2 and 36; if 0, first few characters of str
determines base to be used (oct,hex or dec) any other value
of base is illegal