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,d93b7c6dd17cbc81 X-Google-Attributes: gid103376,public From: David Botton Subject: Re: Strings and reading from a file Date: 1999/05/13 Message-ID: <373B93FC.9E89E2C2@Botton.com>#1/1 X-Deja-AN: 477662793 Content-Transfer-Encoding: 7bit References: <7han2q$jkp$1@news.iinet.net.au> <37399913.BD928DD1@pwfl.com> <7hevh1$g08$1@nnrp1.deja.com> <7hf2bc$imm$1@nnrp1.deja.com> <7hf611$16i$1@cnn.Princeton.EDU> X-Accept-Language: en Content-Type: text/plain; charset=us-ascii X-Complaints-To: abuse@gate.net X-Trace: news.gate.net 926651385 72090 199.227.189.221 (14 May 1999 03:09:45 GMT) Organization: CyberGate, Inc. Mime-Version: 1.0 NNTP-Posting-Date: 14 May 1999 03:09:45 GMT Newsgroups: comp.lang.ada Date: 1999-05-14T03:09:45+00:00 List-Id: May I include your code on The Ada Source Code Treasury at AdaPower.com? David Botton "Martin C. Carlisle" wrote: > > I can't imagine! Probably something more like: > > function Next_Line(File : in Ada.Text_IO.File_Type := > Ada.Text_Io.Standard_Input) return String is > Answer : String(1..256); > Last : Natural; > begin > Ada.Text_IO.Get_Line(File => File, > Item => Answer, > Last => Last); > if Last = Answer'Last then > return Answer & Next_Line; > else > return Answer(1..Last); > end if; > end Next_Line; > > --Martin > > In article <7hf2bc$imm$1@nnrp1.deja.com>, wrote: > >In article <7hevh1$g08$1@nnrp1.deja.com>, > >> Make the function recursive, and it can return a string of any length, > >> eliminating that nagging worry about strings that are longer than > >> whatever magic number you used in the function. > > > >Surely you don't mean (forgive me if Deja decides to throw away my > >formatting): > > > >function Next_Line return String is > > Char : Character; > > Next_Char : Character; > > EOL : Boolean; > >begin > > Get (Char); > > Look_Ahead (Next_Char, EOL); > > if EOL then > > return (1 => Char); > > else > > return Char & Next_Line; > > end if; > >end Next_Line; > > > >I think we may have just smoked out a Lisp programmer... > > > >-- > >T.E.D. > > > > > >--== Sent via Deja.com http://www.deja.com/ ==-- > >---Share what you know. Learn what you don't.--- > > -- > Martin C. Carlisle, Asst Prof of Computer Science, US Air Force Academy > carlislem@acm.org, http://www.usafa.af.mil/dfcs/bios/carlisle.html > DISCLAIMER: This content in no way reflects the opinions, standards or > policy of the US Air Force Academy or the United States Government.