fflush(stdin ) what this does! | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

fflush(stdin ) what this does!

29th Dec 2016, 10:43 AM
Rindi Hasan
Rindi Hasan - avatar
5 Answers
+ 2
Logically it means to write the contents of the internal buffer into the stream. Since stdin is NON WRITABLE, you cannot flush it. But if you want to empty the internal buffer, you may use while (fgetc(stdin)^-1);
29th Dec 2016, 5:49 PM
Suvaditya
Suvaditya - avatar
+ 1
It renders the standard input empty (to avoid buffer overflow for example)
29th Dec 2016, 1:00 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
thank s
29th Dec 2016, 1:38 PM
Rindi Hasan
Rindi Hasan - avatar
+ 1
your welcome :)
29th Dec 2016, 1:50 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar
+ 1
yes,my mistake sorry :s
29th Dec 2016, 5:52 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar