From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=unavailable autolearn_force=no version=3.4.4 Path: eternal-september.org!reader01.eternal-september.org!reader02.eternal-september.org!news.eternal-september.org!mx02.eternal-september.org!feeder.eternal-september.org!gandalf.srv.welterde.de!news.jacob-sparre.dk!loke.jacob-sparre.dk!pnx.dk!.POSTED!not-for-mail From: "Randy Brukardt" Newsgroups: comp.lang.ada Subject: Re: Truncating Direct IO files Date: Tue, 21 Apr 2015 17:01:58 -0500 Organization: Jacob Sparre Andersen Research & Innovation Message-ID: References: <8323246f-eb13-49e8-9e0c-5c5ec1002060@googlegroups.com> NNTP-Posting-Host: rrsoftware.com X-Trace: loke.gir.dk 1429653719 14449 24.196.82.226 (21 Apr 2015 22:01:59 GMT) X-Complaints-To: news@jacob-sparre.dk NNTP-Posting-Date: Tue, 21 Apr 2015 22:01:59 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2900.5931 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2900.6157 X-RFC2646: Format=Flowed; Original Xref: news.eternal-september.org comp.lang.ada:25570 Date: 2015-04-21T17:01:58-05:00 List-Id: "tonyg" 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.