Deutsch English Français Italiano |
<v5f33f$1l548$3@dont-email.me> View for Bookmarking (what is this?) Look up another Usenet article |
Path: ...!2.eu.feeder.erje.net!3.eu.feeder.erje.net!feeder.erje.net!eternal-september.org!feeder3.eternal-september.org!news.eternal-september.org!.POSTED!not-for-mail From: Lew Pitcher <lew.pitcher@digitalfreehold.ca> Newsgroups: comp.lang.c Subject: Question regarding fwrite() and fflush() Date: Tue, 25 Jun 2024 18:42:55 -0000 (UTC) Organization: A noiseless patient Spider Lines: 17 Message-ID: <v5f33f$1l548$3@dont-email.me> MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Injection-Date: Tue, 25 Jun 2024 20:42:55 +0200 (CEST) Injection-Info: dont-email.me; posting-host="378c0296351914fa8a558aaf0b11785d"; logging-data="1741960"; mail-complaints-to="abuse@eternal-september.org"; posting-account="U2FsdGVkX190Yekd5GeLjMwlDJ5EnpLnIbai7205Kak=" User-Agent: Pan/0.139 (Sexual Chocolate; GIT bf56508 git://git.gnome.org/pan2) Cancel-Lock: sha1:z/F1LAMfUI02Aa/J+4f7sSGlMp4= Bytes: 1668 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? -- Lew Pitcher "In Skills We Trust"