comp.lang.ada
 help / color / mirror / Atom feed
From: Jeffrey Carter <jeffrey.carter@boeing.com>
Subject: Re: please help me!!!!!!
Date: Thu, 18 Oct 2001 17:34:28 GMT
Date: 2001-10-18T17:34:28+00:00	[thread overview]
Message-ID: <3BCF12A4.43DC6207@boeing.com> (raw)
In-Reply-To: 9qm0di$25sj$1@newsreader1.mclink.it

You might want to consider using a somewhat more meaningful subject.
When I see something like this, my thoughts are something like:

Somebody who calls himself F has posted a message with the subject
"please help me!!!!!!". Help is needed on what? Is it something I can
help with? Do I want to read the message and perhaps waste my time
finding out it's something I'm not interested in?

F wrote:
> 
> I want to "clean" the keyboard buffer after a user action, for example i
> have a piece of a procedure such as
> ...
> c:character; s:string(1..20); ind:integer:=1;
> ...
> while not end_of_line loop
> get(c);
> s(i):=c;
> i:=i+1;
> end loop;

It's hard to tell, since Ind is never referenced and I is undefined.
However, if I is supposed to be Ind, what you're doing is writing
Ada.Text_IO.Get_Line, except you raise Constraint_Error if the line is
as long as or longer than S, and you don't skip the line terminator if
it isn't. The easy way to do this is

Get_Line (Item => S, Last => Ind);

After this call, S (S'First .. Ind) contains the characters read. If Ind
= S'Last, then the line terminator was not skipped.

-- 
Jeffrey Carter



  parent reply	other threads:[~2001-10-18 17:34 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2001-10-18  7:33 please help me!!!!!! F
2001-10-18 11:04 ` John McCabe
2001-10-18 13:04 ` F
2001-10-18 17:34 ` Jeffrey Carter [this message]
2001-10-18 17:59   ` Jeffrey Carter
replies disabled

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox