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-Thread: 103376,c72c8726f7de6c9b X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news1.google.com!news2.google.com!proxad.net!134.158.69.22.MISMATCH!in2p3.fr!irazu.switch.ch!switch.ch!newsfeed.sunrise.ch!not-for-mail Message-ID: <42EFD521.C38DEE83@fakeaddress.nil> Date: Tue, 02 Aug 2005 22:18:41 +0200 From: Gautier Write-only X-Mailer: Mozilla 4.8 [en]C-CCK-MCD diax30 (Win98; U) X-Accept-Language: fr MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: File manipulations in Ada.Text_IO References: <1122919474.611248.151950@z14g2000cwz.googlegroups.com> Content-Type: text/plain; charset=us-ascii Content-Transfer-Encoding: 7bit Organization: TDC Switzerland AG, http://www.sunrise.ch NNTP-Posting-Host: 194.230.144.152 X-Trace: 1123013918 news.sunrise.ch 1145 194.230.144.152:1571 X-Complaints-To: abuse@sunrise.ch Xref: g2news1.google.com comp.lang.ada:3913 Date: 2005-08-02T22:18:41+02:00 List-Id: 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!