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.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,dc393c3a10696107 X-Google-Attributes: gid103376,public From: Gautier Subject: Re: Create-Delete tmp Files Date: 2000/03/20 Message-ID: <38D63810.6E679322@maths.unine.ch>#1/1 X-Deja-AN: 599930179 Content-Transfer-Encoding: 7bit References: <8at7g0$bhc$1@nnrp1.deja.com> <38D27008.4055C0AB@res.raytheon.com> <8b0pla$aub$1@nnrp1.deja.com> <8b4n77$u4a$1@nnrp1.deja.com> <38D60390.B6155BA6@maths.unine.ch> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Trace: 20 Mar 2000 14:37:52 +0100, mac13-32.unine.ch Organization: Maths - Uni =?iso-8859-1?Q?Neuch=E2tel?= MIME-Version: 1.0 Newsgroups: comp.lang.ada Date: 2000-03-20T00:00:00+00:00 List-Id: > >Maybe you need a more permanent file. A way is to try creating > >files like "tempfile.100". If there must be several, you check > >for existence of "tempfile.100", "tempfile.101", etc. until > >there is a name free. Preben Randhol wrote: > How would you do this codewise? You make a loop with i in 100 .. 999 and check existence of "tempfile." & integer'image(i). If the file doesn't exist, you decide it is the good one: you return the name. Of course one has to be careful if there are parallel tasks doing the same, to lock the free name as soon as possible maybe by creating an bogus file with that name or a more solid method with an array of boolean of the range (say Name_locked:= (others=> false)). If the loop exists normally, you raise an exception such as no_name_available_for_temp_file... This is coded +/- so in the AD trace-back interface for GNAT ( source ad.adb in zip file http://members.xoom.com/gdemont/logiciel/ad.zip or in AdaGIDE, web page http://members.xoom.com/gdemont/ad.htm ) _____________________________________________ Gautier -- http://members.xoom.com/gdemont/