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,5997b4b7b514f689 X-Google-Attributes: gid103376,public From: Jeff Carter Subject: Re: Reading a line of arbitrary length Date: 1997/02/13 Message-ID: <330319F1.41C67EA6@innocon.com>#1/1 X-Deja-AN: 218505851 References: <5ds40o$rpo@fg70.rz.uni-karlsruhe.de> <01bc18d6$41e00680$188c71a5@dhoossr.iquest.com> Content-Type: text/plain; charset=us-ascii Organization: DIGEX Mime-Version: 1.0 Newsgroups: comp.lang.ada X-Mailer: Mozilla 2.0 (X11; U; SunOS 4.1.3 sun4m) Date: 1997-02-13T00:00:00+00:00 List-Id: David C. Hoos, Sr. wrote: > > What you do is read into a temporary String of length larger than any you > will encounter. Then you use the value of the actual parameter supplied > for the formal parameter "Last" to take the appropriate slice from the > temporary string. This assumes, of course, that you can define a "length larger than any you will encounter." In some cases, you cannot. This is still not a problem; see "Variable-Length String Input in Ada," _Ada Letters_, 1989 May/Jun, which presents a function function Get_Line (File : Text_Io.File_Type := Text_Io.Current_Input) return String; which can then be used to initialize a String object: declare S : String := Get_Line; begin -- use S end; Get_Line returns all characters between the current position in File and the next line terminator, and skips the line terminator. The String returned has a lower bound of 1 and a length equal to the number of characters read. -- Jeff Carter Innovative Concepts, Inc. Now go away, or I shall taunt you a second time.