Sujet : Question regarding fwrite() and fflush() De : lew.pitcher (at) *nospam* digitalfreehold.ca (Lew Pitcher) Groupes :comp.lang.c Date : 25. Jun 2024, 19:42:55 Autres entêtes Organisation : A noiseless patient Spider Message-ID :<v5f33f$1l548$3@dont-email.me> User-Agent : Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2)
In a recent reply here, I posted some code that used fwrite() to write binary data to a file. One version of this code used mmap() to access this binary data in-situ, and I wonder if I should have called fflush() before calling mmap().
I understand the where to use fflush() on standard text formatted output (where you use fprintf(), etc to externalize the output), but I don't see anything my copies of either the ISO C or POSIX standards that say that I /should/ use fflush(), but neither do I see anything that says I /need not/ use fflush().
So, wiser and more experienced minds, should I use fflush() in this case or not?