comp.lang.ada
 help / color / mirror / Atom feed
From: nickroberts@blueyonder.co.uk (Nick Roberts)
Subject: Re: if file exist
Date: Thu, 26 Sep 2002 00:39:01 GMT
Date: 2002-09-26T00:39:01+00:00	[thread overview]
Message-ID: <3d9245da.259420486@news.cis.dfn.de> (raw)
In-Reply-To: mv2OjUUhp2Hh@eisner.encompasserve.org

On 23 Sep 2002 06:38:22 -0600, Kilgallen@SpamCop.net (Larry Kilgallen)
strongly typed:

>On some operating systems the existence of a file for which the user
>lacks read permission cannot be detected.  A general solution for
>detecting unreadable files is not possible.

In addition, if you were to do, e.g. on MS-DOS:

   Open(F1,In_File,"COM1:");

You could get failure for a variety of reasons nothing to do with the
existence, non-existence, or readability of files.

In particular, it is quite possible that a file existence detector may say
"COM1:" does not exist (as a file, or as a readable file, or as a readable
text file), yet the above statement may succeed (and be useful).

In full generality, it is not possible for a program to detect the
existence of files for the purposes of determining whether it can
subsequently open them for a particular purpose. On any multi-processing
system, for example, the file could be deleted in between the detection and
the opening.

As far as the Ada program is concerned, the file name "foo" might mean:
hack into the CIA central computer in CIACHQ Langley VA*; select a file at
random with "foo" somewhere in the name; decrypt it using Blowfish and the
key "Oojalum123"; reverse the order of the byte contents; send an e-mail to
Tom Cruise, telling him what a handsome guy he is; insert the names of
known KGB agents into the byte stream at 4KB intervals. The OS can
interpret names how it likes.

In general, I recommend that Ada code simply handles the Name_Error
exception appropriately.

[* properly, now named the George Bush Center for Intelligence]

-- 
Nick Roberts
Per Ardua ad Disastra




  reply	other threads:[~2002-09-26  0:39 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <mailman.1032687678.1150.comp.lang.ada@ada.eu.org>
2002-09-22  9:58 ` if file exist Preben Randhol
2002-09-22 19:25   ` Keith Thompson
2002-09-22 11:26 ` Dale Stanbrough
2002-09-22 14:45   ` Simon Wright
2002-09-22 17:24     ` Frank J. Lhota
2002-09-22 19:24     ` Keith Thompson
2002-09-22 22:20     ` Dale Stanbrough
2002-09-23  5:14       ` Simon Wright
2002-09-23 12:38         ` Larry Kilgallen
2002-09-26  0:39           ` Nick Roberts [this message]
2002-09-26 16:48             ` Warren W. Gay VE3WWG
2002-09-26 22:14               ` Robert A Duff
2002-09-27 10:47                 ` steve_H
2002-09-27 14:01                   ` Robert A Duff
2002-09-27 18:43                   ` Randy Brukardt
2002-09-28  1:17                     ` Keith Thompson
2002-09-28 13:04                       ` Marin David Condic
2002-09-29  4:50                         ` Keith Thompson
2002-09-29  5:13                           ` Christopher Browne
2002-09-27 21:59                   ` Mark Biggar
2002-09-27 23:09                     ` Larry Kilgallen
2002-10-04 20:56                     ` Stefan Skoglund
2002-10-05 13:59                       ` Robert A Duff
2002-10-06 20:35                         ` Keith Thompson
2002-10-07  0:34                       ` Robert A Duff
2002-10-07  5:42                     ` David Thompson
2002-10-13 17:05                       ` Larry Kilgallen
2002-10-21  2:17                         ` David Thompson
2002-09-22 11:55 ` Per Sandbergs
2002-09-22 22:29 ` SteveD
2002-09-23  1:53   ` if_file_exist : it's working thankyou all! Dominic D'Apice
2002-09-23  5:25     ` Simon Wright
2002-09-23 23:59       ` Dominic D'Apice
2002-09-25 19:13         ` Simon Wright
replies disabled

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