On Wed Mar 1 23:58:02 2023 +0000, Zebediah Figura wrote:
I solved it for packoffset() this way, I am sure it works but I am not
sure if it may be considered hacky:
char invalid; if (sscanf(reg_string + 1, "%u%c", &reservation.index, &invalid) != 1)
That works, yeah, although I'm not sure it's the most idiomatic thing. %n may be more idiomatic, or just using strtoul() instead.
I'd vote for `strtoul()` (but then remember to check the end pointer!), thought any solution is fine. Honestly, even if we accepted those extra characters, I wouldn't sink in desperation.