From: dennison@telepath.com
Subject: Re: Strings and reading from a file
Date: 1999/05/13
Date: 1999-05-13T00:00:00+00:00 [thread overview]
Message-ID: <7hf2bc$imm$1@nnrp1.deja.com> (raw)
In-Reply-To: 7hevh1$g08$1@nnrp1.deja.com
In article <7hevh1$g08$1@nnrp1.deja.com>,
jrcarter001@my-dejanews.com wrote:
> In article <37399913.BD928DD1@pwfl.com>,
> diespammer@pwfl.com wrote:
>
> ...
>
> > function Next_Line return String is
> > Str : String (1..256) ;
> > Len : Natural ;
> > begin
> > Get_Line (
> > Item => Str,
> > Last => Len) ;
> > return Str (1..Len) ;
> > end Next_Line ;
>
> ...
>
> 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.---
next prev parent reply other threads:[~1999-05-13 0:00 UTC|newest]
Thread overview: 27+ messages / expand[flat|nested] mbox.gz Atom feed top
1999-05-12 0:00 Strings and reading from a file Cameron Hodge
1999-05-11 0:00 ` David Botton
1999-05-12 0:00 ` Robert Dewar
1999-05-12 0:00 ` dennison
1999-05-12 0:00 ` Cameron Hodge
1999-05-12 0:00 ` David C. Hoos, Sr.
1999-05-12 0:00 ` Marin David Condic
1999-05-12 0:00 ` Tom Moran
1999-05-12 0:00 ` Marin David Condic
1999-05-13 0:00 ` jrcarter001
1999-05-13 0:00 ` dennison [this message]
1999-05-13 0:00 ` Martin C. Carlisle
1999-05-13 0:00 ` Marin David Condic
1999-05-13 0:00 ` Hyman Rosen
1999-05-13 0:00 ` Keith Thompson
1999-05-14 0:00 ` Pascal Obry
1999-05-13 0:00 ` David Botton
1999-05-13 0:00 ` David Botton
1999-05-14 0:00 ` Jean-Pierre Rosen
1999-05-14 0:00 ` Keith Thompson
1999-05-14 0:00 ` David C. Hoos, Sr.
1999-05-14 0:00 ` Keith Thompson
1999-05-15 0:00 ` David C. Hoos, Sr.
1999-05-16 0:00 ` Jean-Pierre Rosen
1999-05-15 0:00 ` jrcarter001
1999-06-05 0:00 ` Matthew Heaney
1999-05-12 0:00 ` Gautier
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox