

6·
3 days agoI’m too lazy to confirm, but I think scanf (as well as many other I/O functions) works on top of the buffered input. I.e. when you scanned only one character on the first run of scanf but there are more left in the buffer, then subsequent calls will read from that buffer, e.g.
printf("your prompt>")
/* you type 123 */
/* buffer contains: "123" */
scanf(...)
/* you scanned 1 char ("1") */
/* buffer contains: "23" */
printf("new prompt>");
/* the prompt has been printed AFTER your previous input but the buffer hasn't been reset! */
/* buffer contains: "23" */
/* you type 456 */
/* buffer contains: "23456" */
scanf(...)
/* scanf returns "2" */
/* buffer contains: "3456" */
In general you have two options:
- drain the buffer after / before each loop cycle
- use unbuffered I/O
For both cases, do your research on how to do it :) That K&R from above should be a great start indeed.
It’s not as much of a Microsoft problem, as it is the problem of the whole app notarization concept, which is extremely hostile to both consumers and developers and provides little to none security benefits. If Apple didn’t have that crap in place, not Microsoft and not anyone else would be able to pull off such stunt.