Even spelled with one f?
But yes, it's not standard.
One would expect that the function would safe-ish - but to assume that fflush() on an input actually does what the above code expects is a different story.
And assuming that it does, why would anyone think that it's better to call flushall() than [not that I'm recommending this solution either] fflush(stdin)? The only difference is that flushall() _ALSO_ flushes any other files that may be open at this time - what's the benefit of that? Note that flushing a file _HAS_ side-effects on that file - so unless you know exactly all the files are open and in what state they are, you are "messing with things you don't have a right to mess with".
Also to the original poster about "how do I know I can call the clear input buffer code?" - if you have successfully come back from a scanf() call, then you DO know that there is at least a neline character ('\n') somewhere waiting to be read. Whether there is also "other stuff" in there is a different question. But there will certainly be a newline - there is no doubt about that. That is because scanf will not receive any of the data from the console/input file before a newline is encountered [1]. This is guaranteed by the way that stdio functions work in C [2].
[1] With one exception - if an end-of-file is reached before a newline is seen, then the input buffer is also released to the input function - so make sure you check for end-of-file when clearing the input buffer.
[2] In some systems YOU CAN change the behaviour of the console input buffering - but this is special functions that you wouldn't use in normal programming. Of the many, many programs I've written so far, maybe 1-2% of them have used this, and I'm sure there are programmers who have worked 20 years without EVER using this sort of modified behaviour of IO - and you can't [in a reliable way] use scanf() or fgets() in this mode of operation.
--
Mats
Compilers can produce warnings - make the compiler programmers happy: Use them!
Please don't PM me for help - and no, I don't do help over instant messengers.