%n takes a signed int so is incompatible with size_t; further, sscanf could in theory return a negative value (EOF).