I have a code that repeats:
printf ("do you want to continue? Y / N: \ n");
keepplaying = getchar ();
works in my next code, it does not wait for input. I found out that getchar in secret time uses '\ n' as a charcter. This is due to some buffer that sdio has, so it saves the last input that was "Y \ n" or "N \ n".
my Q, how do I flush the buffer before using getchar, which will make getchar wait for my response?
source
share