I have a set of strings which looks like
“4 7 14 0 2 blablabla”
“3 8 1 40 blablablablabla”
…
The first number N correspond to how many numbers will follow.
Basically, the format of a string is N+1 numbers, separated with a space, followed by an unknown number of irrelevant characters at the end that I don’t need.
How can I get all the numbers in variables or a dynamic structure given that I don’t know the number N in advance ?
In other words, I’d like something like:
sscanf(s, "%d %d %d %d",&n,&x,&y,&z);
which would work no matter how many numbers in the string.
1 Answer