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,MAILING_LIST_MULTI, REPLYTO_WITHOUT_TO_CC autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,d655a6c8557d8a35 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-02-21 04:21:10 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!freenix!enst!enst.fr!not-for-mail From: "M. A. Alves" Newsgroups: comp.lang.ada Subject: Re: Storing A string Date: Thu, 21 Feb 2002 12:21:08 +0000 (GMT) Organization: ENST, France Sender: comp.lang.ada-admin@ada.eu.org Message-ID: Reply-To: comp.lang.ada@ada.eu.org NNTP-Posting-Host: marvin.enst.fr Mime-Version: 1.0 Content-Type: TEXT/PLAIN; charset=US-ASCII X-Trace: avanie.enst.fr 1014294063 19986 137.194.161.2 (21 Feb 2002 12:21:03 GMT) X-Complaints-To: usenet@enst.fr NNTP-Posting-Date: Thu, 21 Feb 2002 12:21:03 +0000 (UTC) Return-Path: X-X-Sender: In-Reply-To: Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org X-Mailman-Version: 2.0.8 Precedence: bulk List-Help: List-Post: List-Subscribe: , List-Id: comp.lang.ada mail<->news gateway List-Unsubscribe: , Errors-To: comp.lang.ada-admin@ada.eu.org X-BeenThere: comp.lang.ada@ada.eu.org Xref: archiver1.google.com comp.lang.ada:20205 Date: 2002-02-21T12:21:08+00:00 On Thu, 14 Feb 2002, Anthony Wise wrote: > I need my program to be able to accept lines of text. [1] These lines > can be as long or short as the user likes. [2] I am using the Get_Line > procedure (Using only one string) Note that, in rigour, [1] and [2] are incompatible, since a String has limited length. However we can assume a big limit = no limit in practice, and for expository purposes of the next question. > , however this allows only one entery. So i put Get_Line in a loop, > but now the only accessable input is the last input. Is there anyway > i can store all the inputs so i can process them and then output them > all together. Store where? In main memory? Sure. Since we are already in a 'limits' idiom, I suggest an array of Unbounded_String e.g. (not tested): Line_Buffer : String (1 .. 1000); Line_Length : Natural range 0 .. Line_Buffer'Last; Line_Store : array (1 .. 10_000) of Unbounded_String; Line_Count : Natural range 0 .. Line_Store'Last; begin loop Get_Line (Line_Buffer, Line_Length); Line_Count := Line_Count + 1; Line_Store (Line_Count) := To_Unbounded_String (Line_Buffer (1 .. Line_Length)); ... -- some exit condition here end loop; -- 'output them all together' (?) here -- , M A R I O data miner, LIACC, room 221 tel 351+226078830, ext 121 A M A D O Rua Campo Alegre, 823 fax 351+226003654 A L V E S P-4150-180 PORTO, Portugal mob 351+939354002