From: "Randy Brukardt" <randy@rrsoftware.com>
Subject: Re: Truncating Direct IO files
Date: Tue, 21 Apr 2015 17:01:58 -0500
Date: 2015-04-21T17:01:58-05:00 [thread overview]
Message-ID: <mh6hcn$e3h$1@loke.gir.dk> (raw)
In-Reply-To: 8323246f-eb13-49e8-9e0c-5c5ec1002060@googlegroups.com
"tonyg" <tonythegair@gmail.com> wrote in message
news:8323246f-eb13-49e8-9e0c-5c5ec1002060@googlegroups.com...
>
>
> I am recording records to disk. Sometimes I replace thes records with a
> smaller set of records.
> I could delete the file each time but would prefer to truncate the
> file. I can't see a way of doing this, can you?
Ada doesn't provide that, mainly because not all popular operating systems
provide a truncation mechanism for files, and we don't want implementations
to have to fall back on the very expensive copy the whole file and replace
mechanism (obviously, if that is acceptable to you, you can write that
yourself).
It appears that Ada 95 stream files provide truncation on Close and Reset
(and thus some implementations do implement that, but all surveyed
implementations did it wrong), but many implementations don't truncate and
Ada 2005 and later removed the wording that appeared to require it. So one
cannot depend on that.
Randy.
prev parent reply other threads:[~2015-04-21 22:01 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-04-21 7:30 Truncating Direct IO files tonyg
2015-04-21 7:47 ` Dmitry A. Kazakov
2015-04-21 8:20 ` tonyg
2015-04-21 9:17 ` Dmitry A. Kazakov
2015-04-21 22:01 ` Randy Brukardt [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox