Mmm.. the man pages for strtol, says that the number needs needs some white spaces and a + or - sign.. is that necessary?, and what about the end of the number, if I don't want to specify one, NULL is ok right? and.. what does the last argument is for?


Taking the last argument into consideration you could parse values like 0777 as 511 or 0x000AEF10 as 716560. But the code I posted doesn't automatically just know how to do that. It lazily detects any character and calls the whole parameter a string. So to avoid that you'd have to have it preprocess each variable for octal or hexidecimal numbers.