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 12:30:52 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newsfeed.icl.net!newsfeed.fjserv.net!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: 25 Sep 2002 20:13:07 +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 1032982251 29298 62.49.19.209 (25 Sep 2002 19:30:51 GMT) X-Complaints-To: abuse@demon.net NNTP-Posting-Date: Wed, 25 Sep 2002 19:30:51 +0000 (UTC) User-Agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.1 Xref: archiver1.google.com comp.lang.ada:29333 Date: 2002-09-25T20:13:07+01:00 List-Id: "Dominic D'Apice" writes: Dominic, I would find it much easier to try to help you if you would put your comments _after_ the part of my message that you are responding to. As I have done in this article. Indeed, I had to read to the end before I found out it was my article you were replying to. So you nearly didn't get a reply at all (of course, you may not care!) > 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... I understood that .. > Well, may I don't understand , what you tell.. This is your code (slightly reformatted): 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; and I'm suggesting that this would be even more useful: procedure si_fic_existe (nom_fic : in String; mod_fic_ecr : in ada.text_io.file_mode) is fichier : ada.text_io.file_type; 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; because you aren't asking your caller to supply a variable (fichier) which is of no use to him after your procedure has returned. -S