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.3 required=5.0 tests=BAYES_00,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no 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-23 17:00:04 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!fr.usenet-edu.net!usenet-edu.net!enst.fr!not-for-mail From: "Dominic D'Apice" Newsgroups: comp.lang.ada Subject: RE: if_file_exist : it's working thankyou all! Date: Mon, 23 Sep 2002 19:59:03 -0400 Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit X-Trace: avanie.enst.fr 1032825604 21534 137.194.161.2 (24 Sep 2002 00:00:04 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Tue, 24 Sep 2002 00:00:04 +0000 (UTC) Return-Path: X-Priority: 3 (Normal) X-MSMail-Priority: Normal X-Mailer: Microsoft Outlook, Build 10.0.2616 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2600.0000 Importance: Normal In-Reply-To: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.13 Precedence: bulk List-Unsubscribe: , List-Id: comp.lang.ada mail<->news gateway List-Post: List-Help: List-Subscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:29296 Date: 2002-09-23T19:59:03-04:00 The thing is i would like to verify if the file exist ; 1- try to open the file if file not there then it goes to exception (AT THE END OF THE PROCEUDRE and it do nothing (null;) => that what I want BUT 2-If file there then Close it AND RAISE THE REAL EXEPTION (LOCATED IN MAIN PROGRAM, MEANS THAT THE FILE EXIT... Well, may I don't understand , what you tell.. Dominic -----Original Message----- From: comp.lang.ada-admin@ada.eu.org [mailto:comp.lang.ada-admin@ada.eu.org] On Behalf Of Simon Wright Sent: 23 septembre, 2002 01:26 To: comp.lang.ada@ada.eu.org Subject: Re: if_file_exist : it's working thankyou all! "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. _______________________________________________ comp.lang.ada mailing list comp.lang.ada@ada.eu.org http://ada.eu.org/mailman/listinfo/comp.lang.ada