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=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,6482d0ae6dcb1b4c X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-25 17:38:55 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!fu-berlin.de!uni-berlin.de!pc-62-31-50-169-cr.blueyonder.co.UK!not-for-mail From: nickroberts@blueyonder.co.uk (Nick Roberts) Newsgroups: comp.lang.ada Subject: Re: if file exist Date: Thu, 26 Sep 2002 00:39:01 GMT Organization: AdaOS Message-ID: <3d9245da.259420486@news.cis.dfn.de> References: NNTP-Posting-Host: pc-62-31-50-169-cr.blueyonder.co.uk (62.31.50.169) X-Trace: fu-berlin.de 1033000733 9628133 62.31.50.169 (16 [25716]) X-Newsreader: Forte Free Agent 1.21/32.243 Xref: archiver1.google.com comp.lang.ada:29340 Date: 2002-09-26T00:39:01+00:00 List-Id: 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