Is it possible to run sscanf with multiple format specifiers which will each set a single item in an array? Currently, I have to specify the pointers to each array slot separately, which feels very repetitive:
unsigned int buffer[8];
sscanf(
line,
"%6o %6o %6o %6o %6o %6o %6o %6o",
buffer + 0,
buffer + 1,
buffer + 2,
buffer + 3,
buffer + 4,
buffer + 5,
buffer + 6,
buffer + 7);
I'm looking for something similar to JavaScript's spread operator or Python's *-operator for unpacking argument lists:
sscanf(
line,
"%6o %6o %6o %6o %6o %6o %6o %6o",
...buffer);
At the moment, this fails with the following error:
file.c:42:21: error: format ‘%o’ expects a matching ‘unsigned int *’ argument [-Werror=format=]
Which is kind of expected. How can I tell sscanf to put each format specifier value into consecutive slots in the array? Is it possible? If not, is there a clever workaround (hack)?