I was curious if it’s possible to implement a sort of variadic version of scanf in C. What I mean is if the input is push (1 2 3), scanf would be able to parse that into %s %d %d %d with something like scanf("%s (%d)", string, some_list).
It would take all instances of %d and append them (in order) to the list…
Am I talking sense?
EDIT: For the specified input, string == "push" and some_list == [1, 2, 3].
Isn’t vscanf, vssscanf, vsfcanf is what you are looking for? They are avaialble from C99 onwards.
Here is a decription and example of usage of vscanf function. Note that C being a compiled and a strongly typed language, you need to give format specifiers properly. Doing something like what higher languages dos is going to involve more work (but is possible because features are inturn written in C).