Re: scanf behaviour
Mark McIntyre wrote:
I don't know about XP, but on Solaris fflush() on an input stream is
defined:
"Flushing an input stream discards any buffered input and
adjusts the file pointer such that the next input operation
accesses the byte after the last one read."
This non-standard behaviour probably goes back to pre-standard days and
should be avoided in portable code.
--
Ian Collins.
Mark McIntyre wrote:
On 24 Nov 2006 23:29:46 -0800, in comp.lang.c , stasgold@gmail. com
wrote:
>
>
That means nothing. It may work only in debug mode, or only provided
there is no other file operation going on in another application, or
only on saturdays. Tomorrow, when you're doing a demonstration to your
boss, it may fail.
>
wrote:
>
>>I've tested "fflush( stdin );" on both WinXP and SunOS boxes it works
>>without a glitch.
>>without a glitch.
That means nothing. It may work only in debug mode, or only provided
there is no other file operation going on in another application, or
only on saturdays. Tomorrow, when you're doing a demonstration to your
boss, it may fail.
>
defined:
"Flushing an input stream discards any buffered input and
adjusts the file pointer such that the next input operation
accesses the byte after the last one read."
This non-standard behaviour probably goes back to pre-standard days and
should be avoided in portable code.
--
Ian Collins.
Comment