From: Gautier Write-only <gautier@fakeaddress.nil>
Subject: Re: File manipulations in Ada.Text_IO
Date: Tue, 02 Aug 2005 22:18:41 +0200
Date: 2005-08-02T22:18:41+02:00 [thread overview]
Message-ID: <42EFD521.C38DEE83@fakeaddress.nil> (raw)
In-Reply-To: 1122919474.611248.151950@z14g2000cwz.googlegroups.com
Zheng Wang:
> Hi,
>
> I would like to ask a simple question about Ada.Text_IO, please.
> How could we check if a file exists or not? I mean is there a function
> or procedure that takes a File_Type/File_Name and returns true if the
> File exists, otherwise return false.
> Many thanks in advance.
You mean something like that ?
with Ada.Text_IO;
--
function Exist(name:String) return Boolean is
use Ada.Text_IO;
f: File_Type;
begin
Open(f,in_file,name);
Close(f);
return True;
exception
when Name_Error => return False;
end Exist;
______________________________________________________________
Gautier -- http://www.mysunrise.ch/users/gdm/index.htm
Ada programming -- http://www.mysunrise.ch/users/gdm/gsoft.htm
NB: For a direct answer, e-mail address on the Web site!
prev parent reply other threads:[~2005-08-02 20:18 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2005-08-01 18:04 File manipulations in Ada.Text_IO Zheng Wang
2005-08-01 18:18 ` Georg Bauhaus
2005-08-01 18:51 ` Jeffrey Carter
2005-08-01 19:32 ` Larry Kilgallen
2005-08-01 21:12 ` Randy Brukardt
2005-08-02 12:31 ` Larry Kilgallen
2005-08-02 2:34 ` Jeffrey Carter
2005-08-08 22:25 ` Robert A Duff
2005-08-09 2:46 ` Jeffrey Carter
2005-08-02 20:18 ` Gautier Write-only [this message]
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox