comp.lang.ada
 help / color / mirror / Atom feed
From: "Dominic D'Apice" <dapiced@sympatico.ca>
Subject: RE: if_file_exist : it's working thankyou all!
Date: Mon, 23 Sep 2002 19:59:03 -0400
Date: 2002-09-23T19:59:03-04:00	[thread overview]
Message-ID: <mailman.1032825603.13845.comp.lang.ada@ada.eu.org> (raw)
In-Reply-To: <x7vu1khwa3l.fsf@pushface.org>

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" <dapiced@sympatico.ca> 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




  reply	other threads:[~2002-09-23 23:59 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
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 [this message]
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