comp.lang.ada
 help / color / mirror / Atom feed
From: "Dmitry A. Kazakov" <mailbox@dmitry-kazakov.de>
Subject: Re: Smart to put "Flush(myfile)" before "Close(myfile") ?
Date: Mon, 25 Jan 2021 13:05:22 +0100	[thread overview]
Message-ID: <rumc61$f3v$1@gioia.aioe.org> (raw)
In-Reply-To: d533bde1-cb8a-4a45-9f95-6f2cb2a2677fn@googlegroups.com

On 2021-01-25 06:42, reinert wrote:
> Can an exception (runtime error) in principle, after closing a file, interrupt the process of writing the actual file to disc?

Depends on the error. If you crash the OS some cached stuff might get 
lost. That depends on the filesystem. If you managed to wipe out the 
RAID controller's cache as well as its persistent memory that would 
destroy anything there. Let your fantasy fly...

> I.e. is it smart to include a "Flush(myfile)" before "Close(myfile)" like this:
> 
> Create  (myfile, Out_File, "myfilename");
> ... Put .. Put
> Flush(myfile);
> Close(myfile);

AFAIK closing file flushes all file buffers and writes the file size. 
Thus calling Flush should change nothing.

-- 
Regards,
Dmitry A. Kazakov
http://www.dmitry-kazakov.de

  parent reply	other threads:[~2021-01-25 12:05 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-01-25  5:42 Smart to put "Flush(myfile)" before "Close(myfile") ? reinert
2021-01-25 11:41 ` Jeffrey R. Carter
2021-01-25 12:05 ` Dmitry A. Kazakov [this message]
2021-01-25 13:32   ` G.B.
2021-01-26  5:30     ` reinert
2021-01-26  8:01       ` Dmitry A. Kazakov
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox