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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,87c9eb1ac78f3483,start X-Google-Attributes: gid103376,public From: john@assen.demon.co.uk (John McCabe) Subject: [Ada.]Text_IO.Create Date: 1997/05/13 Message-ID: <3378c3c3.3637188@news.demon.co.uk>#1/1 X-Deja-AN: 241417701 X-NNTP-Posting-Host: assen.demon.co.uk [158.152.218.101] Newsgroups: comp.lang.ada Date: 1997-05-13T00:00:00+00:00 List-Id: I'd be grateful if anyone would let me know their thoughts, or correct me on the following matter. I'd also appreciate any replies via email to mccabe@mmsuk.co.uk. I am currently trying to implement some very basic file handling on an embedded VME PC with a floppy disk drive attached. I'm trying to make it look similar to the Text_IO specification (I know you can get this with some compilers, and from some third parties probably, but we don't have it so we're doing it ourselves). Anyway, I am currently trying to implement a Create function (like in Text_IO), however it is not clear to me (either from the Ada 83 LRM or the Ada 95 ARM) exactly what behaviour is expected if Create is called for a file that already exists. It does state that it "Establishes a new external file", however this seems a bit wooly. I then had a look at the a-textio.ads/b and s-fileio.adb files to see how this case was handled in GNAT, and noted that if GNAT is creating an Out_File, it uses the open method "w" in a call to fopen which, if the file already exists, will [probably] truncate it. This would be the behaviour I personally would expect, and I wonder if this is actually what is meant by "Establishes a new external file", however I also wonder whether alternative behaviour such as raising NAME_ERROR or USE_ERROR would be acceptable, or possibly even appending to the existing file (but this sounds wrong). Further, I find the concept of creating an In_File interesting. I noted from s-fileio.adb that if a call to Create is made with the mode In_File, the open method "w+" is passed to the fopen function (i.e. append-ish). I'd appreciate the information if anyone knows whether this is a typical implementation and whether there is some precedent or advice anywhere on this matter. I did look to the Ada 95 Rationale for information but found nothing of use on this subject. Thanks in advance for any information. Best Regards John McCabe