you have to extract 'manually' the substrings corresponding to each number then you apply strtol() (this is one solution) to each one of them, e.g. strtol("1110",0,10) returns you (long)1110. For the 'how extract the number', I let you think a bit (you can check strtok() for instance).

PS: you can use the -'0' thing as you say, if you write your own str to int function (as you work on single digits)