Niels Hald Pedersen wrote:
> (if having a \n at the end of the printed string, it is not necessary to
> flush afterwards (glynn will probably say that this is not true on all
> systems, but it works on my Linices (experimental plural)).
If a stream is line-buffered, it will be flushed whenever a \n is
written to it. stdout is line buffered if it corresponds to a TTY
device, and fully buffered otherwise.
So, if you run the program with stdout connected to the terminal,
writing a \n is sufficient to flush the stream. If you were to use
`./prog | cat', then writing \n won't flush the stream.
The above is true for all Unices (i.e. this behaviour is sufficiently
standard that anything which doesn't behave like this has no right to
call itself Unix).
--
Glynn Clements <[EMAIL PROTECTED]>