-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Pramoda M. A wrote:
> This will run in thread. But here, "entered"  and "entered 2"is printing.  
> But "entered 3" and "printing 4" both are not printing.

Some of the printfs are spelt with leading capital P and others with
lower case.  Some have a trailing a newline and some don't.  The default
behaviour of printf is to accumulate what you are supplying into a
buffer across calls.  (This makes it a lot more efficient if you are
printing several short strings or even a character at a time.)

The buffer is flushed if it fills up (buffer size is implementation
dependent but usually a power of 2 somewhere between 512 and 8092).  An
additional rule is that if the output is determined to be a terminal in
which case the buffer will also be flushed when a newline is seen.

Consequently you wouldn't have seen the output from those lines lacking
the trailing newline if they are executed until some other printf that
does have a newline is printf'ed.

(The whole stdio/printf thing is actually pretty hairy behind the
scenes.  Some fun functions you may not have known about are fflush,
setbuf/setvbuf, freopen, fdopen and in glibc fopencookie!)

Roger

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.9 (GNU/Linux)

iEYEARECAAYFAkpW8FAACgkQmOOfHg372QRzXQCdGUdFlnmmfpDN7gO88bKg8hYV
pQMAoMBjezdrLfB1u572uewq6BdKcTFZ
=JIVF
-----END PGP SIGNATURE-----
_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to