From: john@assen.demon.co.uk (John McCabe)
Subject: [Ada.]Text_IO.Create
Date: 1997/05/13
Date: 1997-05-13T00:00:00+00:00 [thread overview]
Message-ID: <3378c3c3.3637188@news.demon.co.uk> (raw)
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 <john@assen.demon.co.uk>
next reply other threads:[~1997-05-13 0:00 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
1997-05-13 0:00 John McCabe [this message]
1997-05-14 0:00 ` [Ada.]Text_IO.Create Jeff Carter
[not found] ` <dewar.863640175@merv>
1997-05-15 0:00 ` [Ada.]Text_IO.Create Larry Kilgallen
1997-05-15 0:00 ` [Ada.]Text_IO.Create John McCabe
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox