Suppose i get an array of chars
"(1110,999)(10,10)"
how extract the numbers which are in the coordinates
1110
999
10
the -'0' thing works only for a single digit numbers
??
Suppose i get an array of chars
"(1110,999)(10,10)"
how extract the numbers which are in the coordinates
1110
999
10
the -'0' thing works only for a single digit numbers
??
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)
Last edited by root4; 01-03-2009 at 06:44 AM.