C: sscanf but number of variables unknown
assign integers into array form string.
"123,456,789,0123,4567,8901" (comma separated 6 integer numbers)
a = 123; a = 456 ....a = 8901
Idea is sscanf(string,"%d%d%d...",&(a),&(a),&(a)...)
Problem is that array size is unknown until the string is available for scanning. It could be huge.
What I thought:
Sounds like file scanning, it is easy. But, scanning same string gives me same value.
Umm.. vscanf or something else would do, once format string is determined. Yes, the format string can be made without any trouble. but how to pass variable??
What I did:
scan one variable, then manipulate string to clear fields from top to comma, scan next variable. (loop)
My way works, however, is there any smarter way?