comp.lang.ada
 help / color / mirror / Atom feed
* how to validate if a file exist ?
@ 2002-09-22 18:25 Dominic D'Apice
  2002-09-22 21:12 ` Chad R. Meiners
  0 siblings, 1 reply; 3+ messages in thread
From: Dominic D'Apice @ 2002-09-22 18:25 UTC (permalink / raw)


Hi all, 

I know that i can validate if a file don’t exist with this :

---------------------------------------------------
  exception when ada.text_io.name_error => 
		     ada.text_io.put("file not found");
	           ada.text_io.skip_line;
---------------------------------------------------


BUT, HOW CAN I VALIDATE IF A FILE EXIST ? 
(I did not found any exception about this way…)


thank to reply
Dominic




^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to validate if a file exist ?
       [not found] <000101c26265$622bc5d0$0101a8c0@dominic>
@ 2002-09-22 20:05 ` sk
  0 siblings, 0 replies; 3+ messages in thread
From: sk @ 2002-09-22 20:05 UTC (permalink / raw)


Hi,

If you use Gnat, try Gnat.Io_Aux.File_Exists (...)


-- 
-------------------------------------
-- Merge vertically for real address
-------------------------------------
s n p @ t . o
 k i e k c c m
-------------------------------------



^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: how to validate if a file exist ?
  2002-09-22 18:25 Dominic D'Apice
@ 2002-09-22 21:12 ` Chad R. Meiners
  0 siblings, 0 replies; 3+ messages in thread
From: Chad R. Meiners @ 2002-09-22 21:12 UTC (permalink / raw)


begin
    Open (...);
    -- file exists and is open
    Close (...);
exception
    when name_error =>
        -- file does not exist.
end;

You have two paths here so if you don't end up handling the exception the
file exists, right?
Please note that you shouldn't expect an exception for the existence of a
file.  If you are taking a class, should discuss this with your instructor;
you seem to misunderstand how the exception mechanism is meant to be used.

"Dominic D'Apice" <dapiced@sympatico.ca> wrote in message
news:mailman.1032719103.21393.comp.lang.ada@ada.eu.org...
Hi all,

I know that i can validate if a file don't exist with this :

---------------------------------------------------
  exception when ada.text_io.name_error =>
     ada.text_io.put("file not found");
           ada.text_io.skip_line;
---------------------------------------------------


BUT, HOW CAN I VALIDATE IF A FILE EXIST ?
(I did not found any exception about this way.)


thank to reply
Dominic






^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2002-09-22 21:12 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <000101c26265$622bc5d0$0101a8c0@dominic>
2002-09-22 20:05 ` how to validate if a file exist ? sk
2002-09-22 18:25 Dominic D'Apice
2002-09-22 21:12 ` Chad R. Meiners

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox