I'm doing an assignment for a C course I am in.
For part of the assignment I am loading integers that are specified in a string of characters into an array.
For example, if I have this string:
"1,5-7,12"
I want to load the numbers 1, 5, 6, 7, 12 into an array of integers.
I could probably do this with a large amount of code, but I am wondering if there is some function that will help me out a bit here. I figure sscanf isn't going to do much for me.
The main problem I see is with multi-digit integers, like 12. In the string it is stored as the two seperate characters '1' and '2', I would need to convert that into the integer 12.
I would really appreciate it if someone could give me an idea of the best way to go about this... thank you.