I used to use fflush(stdin). I read that this is not a good way to get rid of the extra characters and that it is better to use fgets like this:
fgets(buffer,maxsize,stdin);
In cases that I want to dispose of those extra chars…what kind of buffer should I use? Could I redirect in some kind of “buffer of no return”? Or do I have to use a finite size array?
Thanks in advance.
http://c-faq.com/stdio/stdinflush2.html