comp.lang.ada
 help / color / mirror / Atom feed
* File Management query - LRM unclear
@ 2000-02-07  0:00 dommo1234
  2000-02-07  0:00 ` Ted Dennison
  0 siblings, 1 reply; 2+ messages in thread
From: dommo1234 @ 2000-02-07  0:00 UTC (permalink / raw)


Hi all,

I wonder if someone could please clear something up for me. I want to
use the 'Delete(..)' primitive to remove a file on my local filesystem.
This requires that the file is open. I'm writing a delete procedure
that takes a string specifying the pathname of the file for deletion. I
have defined a package that provides functionality for opening a file
and holding information about it, including the File_Type instance
returned when the file is opened. Now, when *my* delete procedure is
called, I envoke the (my) function that attempts to open the file, in
order to obtain the File_Type instance required to call the Ada
library's Delete(..) primitive. Now comes the query. If the external-
file is already open, the exception 'Status_Error' gets thrown. That
*is* clear (LRM A.8.2[8]), but what isn't clear, is whether or not the
File_Type instance associated with the already-open external file is
supposed to be returned in the first (in/out) parameter of the Delete
primitive. If not, how can I obtain it, in order that I may actually
delete the file?

I hope the explanation is clear enough - if not pls ask me to clarify.
Thanks, Dom.


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 2+ messages in thread

* Re: File Management query - LRM unclear
  2000-02-07  0:00 File Management query - LRM unclear dommo1234
@ 2000-02-07  0:00 ` Ted Dennison
  0 siblings, 0 replies; 2+ messages in thread
From: Ted Dennison @ 2000-02-07  0:00 UTC (permalink / raw)


In article <87n35g$uuo$1@nnrp1.deja.com>,
  dommo1234@my-deja.com wrote:

> called, I envoke the (my) function that attempts to open the file, in
> order to obtain the File_Type instance required to call the Ada
> library's Delete(..) primitive. Now comes the query. If the external-
> file is already open, the exception 'Status_Error' gets thrown. That
> *is* clear (LRM A.8.2[8]), but what isn't clear, is whether or not the
> File_Type instance associated with the already-open external file is
> supposed to be returned in the first (in/out) parameter of the Delete
> primitive. If not, how can I obtain it, in order that I may actually
> delete the file?

I think that wasn't specified because...well...because that isn't
specified. You can pretty much assume that the already opened file
object will *not* be returned. The whole point of the error is that
it could not open the file for you. Telling you that, then
proceeding to open the file for you would be a bit silly. That would be
roughtly like a clerk saying, "I'm sorry but I can't give you a salt
bagel because someone has already taken the last one.", and then going
over to that customer, taking their bagel, handing it to you, and saying
"See, here it is."

I'm afraid that the onus is going to have to be on the caller of your
routine to ensure that the file is not open. That may sound like a pain,
but I'd be willing to bet the other customer's salt bagel that your OS's
file deletion command works the same way. :-)

--
T.E.D.

http://www.telepath.com/~dennison/Ted/TED.html


Sent via Deja.com http://www.deja.com/
Before you buy.




^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2000-02-07  0:00 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2000-02-07  0:00 File Management query - LRM unclear dommo1234
2000-02-07  0:00 ` Ted Dennison

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