write() is a system call, the strings or characters it writes doesn't get buffered by a user-space buffer. C library IO functions like fputs() ,fprintf() or puts() is user space code; all the data they write is written to a user space buffer (you don't notice this if all you are writing is user space codes, if you are doing system programming with some user space codes you will find that the data actually gets buffered). To make such data out of buffer, use fflush(). Check the man page of fflush() yourself.
No comments:
Post a Comment