If you care about performance here both strtol and sscanf are ridiculously slow.  I'm guessing you don't ;).