Ask HN: When did fflush got defined for stdin as well?
Today I checked the man for fflush and this surprised me:
For output streams, fflush() forces a write of all user-space buffered data for the given output or update stream via the stream's underly
ing write function. For input streams, fflush() discards any buffered data that has been fetched from the underlying file, but has not
been by the application. The open status of the stream is unaffected.
I remember it very clearly fflush was defined only for output streams.I looked at my copy of K&R and K&R defines it as such:
int fflush(FILE *stream) On an output stream, fflush causes any buffered but unwritten data to be written; on an input stream, the effect is undefined. It returns EOF for a write error, and zero otherwise. fflush(NULL) flushes all output streams.
When did the change happen?
2 comments
[ 3.2 ms ] story [ 16.4 ms ] threadI searched for fflush C99 and based on absence of any credible link, I assumed nothing has changed in C99(and nothing really has changed as far as standards go).