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.1 required=5.0 tests=BAYES_00, PP_MIME_FAKE_ASCII_TEXT autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII X-Google-Thread: 103376,386228a37afe967f X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2003-07-17 11:05:03 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!bloom-beacon.mit.edu!nycmny1-snh1.gtei.net!news.gtei.net!newsfeed.mathworks.com!oleane.net!oleane!nnrp.oleane.net!skymaster!nobody From: "Jean-Pierre Rosen" Newsgroups: comp.lang.ada Subject: Re: Computer Language Shootout Date: Thu, 17 Jul 2003 19:36:19 +0200 Organization: Adalog Message-ID: References: <1ec946d1.0307150715.4ba69f85@posting.google.com> <3F149243.80304@attbi.com> <3F15930C.2070907@attbi.com> NNTP-Posting-Host: mailhost.axlog.fr X-Trace: s1.read.news.oleane.net 1058464885 20802 195.25.228.57 (17 Jul 2003 18:01:25 GMT) X-Complaints-To: abuse@oleane.net NNTP-Posting-Date: Thu, 17 Jul 2003 18:01:25 +0000 (UTC) X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4522.1200 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4522.1200 Xref: archiver1.google.com comp.lang.ada:40419 Date: 2003-07-17T19:36:19+02:00 List-Id: "Wesley Groleau" a �crit dans le message news: evacnf433pJrU4uiXTWJgA@gbronline.com... > Preben Randhol wrote: > > I sometimes use this procedure: > > > > procedure Get_Whole_Line > > (File : in File_Type; > > Item : out String; > > Last : out Natural) > > is > > I often use a function, which reads > from the file into a temporary, > and then returns Temp (1 .. Last) > > The difficulty is knowing how big to make > the temporary. > This one reads a line with no length limit: function Get_Line return String is Buffer : String (1..500); -- or whatever Last : Natural; begin Get_Line (Buffer, Last); if Last < Buffer'Last then return Buffer (1..Last); else return Buffer & Get_Line; end if; end Get_Line; In most cases, there will be only one call, while having no upper limit. The size of the buffer is just a matter of optimization. -- --------------------------------------------------------- J-P. Rosen (rosen@adalog.fr) Visit Adalog's web site at http://www.adalog.fr