[OT]-ish: Can someone explain this?

Andrew Suffield asuffield at suffields.me.uk
Sat Jul 2 18:04:13 BST 2011


On Sat, Jul 02, 2011 at 05:32:38PM +0100, Dirk Koopman wrote:
> But how come I get output at a shell prompt, and not down a pipe (or
> a redirection either)? What special magic is occurring here?

If:

1. isatty() is true on the underlying fd of the FILE*

and:

2. The string contains \n

then printf calls fflush().

In your first instance, stdout was your terminal, and in the second it
was one end of a pipe.


More information about the london.pm mailing list