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-22 22:43:32 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!skynet.be!skynet.be!kibo.news.demon.net!news.demon.co.uk!demon!not-for-mail From: Simon Wright Newsgroups: comp.lang.ada Subject: Re: if_file_exist : it's working thankyou all! Date: 23 Sep 2002 06:25:50 +0100 Organization: Pushface Sender: simon@smaug Message-ID: References: NNTP-Posting-Host: pogner.demon.co.uk Mime-Version: 1.0 Content-Type: text/plain; charset=us-ascii X-Trace: news.demon.co.uk 1032759811 16890 62.49.19.209 (23 Sep 2002 05:43:31 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Mon, 23 Sep 2002 05:43:31 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:29272 Date: 2002-09-23T06:25:50+01:00 List-Id: "Dominic D'Apice" writes: > Well, it's working good ! > > -- verifie si un fichier existe > procedure si_fic_existe (fichier : out ada.text_io.file_type > ; > mod_fic_ecr : in ada.text_io.file_mode > ; nom_fic : in string > ) is > begin > > ada.text_io.open (fichier,mod_fic_lec,nom_fic); > ada.text_io.close(fichier); > raise sortir_program_principal; > exception when ada.text_io.name_error => null; > > end si_fic_existe; Why are you passing fichier in, since you exit with it closed (the file didn't exist) or indeterminate (if it did)? Do you think a local variable would be more appropriate? By the way, if you check the ARM in Annex A (A.13) you will find The exception Name_Error is propagated by a call of Create or Open if the string given for the parameter Name does not allow the identification of an external file. For example, this exception is propagated if the string is improper, or, alternatively, if either none or more than one external file corresponds to the string.