+ 8
Flush stdin
How can I flush stdin in c without use fflush function
1 Réponse
+ 2
You can just read / get on stdin until you hit whatever character indicates "stop flushing"
Basically, ignore/discard input up to a certain point, like a space, or \n or EOF.
note to visitors:
fflush(any input stream) is undefined behavior; nothing about this question should imply that's an alternative.
ref: Why fflush(stdin) is wrong
https://faq.cprogramming.com/cgi-bin/smartfaq.cgi?answer=1052863818&id=1043284351