On Sat, Jan 07, 2006 at 03:33:43PM -0800, Eric Wong wrote:
> fflush(NULL) seems to flush the stdin stream, as well as any open
> streams it can find, regardless of whether or not it's a writeable
> stream. According to the fflush manpage, this is wrong:
>
> If the stream argument is NULL, fflush() flushes all open
> output streams.
>
> You can see this behavior with the test program I've included below, and
> then test it again by commenting out the fflush(NULL) call in it to see
> the difference.
Hi Eric, while I can see from the dietlibc sources that indeed the input
streams including stdin are fflushed, I currently cannot see the impact.
Can you please show me how to use your test program to see a difference?
Thanks, Gerrit.
> #include <stdio.h>
> #include <string.h>
>
> int main (void)
> {
> char buf[4096];
> while (fgets(buf,4096,stdin)) {
> /* this can also be fwrite/fprintf: */
> write(1,buf,strlen(buf));
>
> /* you can comment this out to compare */
> fflush(NULL);
> }
>
> return 0;
> }
>
> /* EOF */
--
To UNSUBSCRIBE, email to [EMAIL PROTECTED]
with a subject of "unsubscribe". Trouble? Contact [EMAIL PROTECTED]