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.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,26f4415626696f47 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-10-18 11:13:20 PST Newsgroups: comp.lang.ada Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!newspeer.radix.net!uunet!ash.uu.net!xyzzy!nntp From: Jeffrey Carter Subject: Re: please help me!!!!!! X-Nntp-Posting-Host: e246420.msc.az.boeing.com Content-Type: text/plain; charset=us-ascii Message-ID: <3BCF186B.3AE5FD70@boeing.com> Sender: nntp@news.boeing.com (Boeing NNTP News Access) Content-Transfer-Encoding: 7bit Organization: The Boeing Company X-Accept-Language: en References: <9qm0di$25sj$1@newsreader1.mclink.it> <3BCF12A4.43DC6207@boeing.com> Mime-Version: 1.0 Date: Thu, 18 Oct 2001 17:59:07 GMT X-Mailer: Mozilla 4.73 [en]C-CCK-MCD Boeing Kit (WinNT; U) Xref: archiver1.google.com comp.lang.ada:14904 Date: 2001-10-18T17:59:07+00:00 List-Id: Jeffrey Carter wrote: > > 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. I seemed to have tripped over my tongue while typing this. This code raises Constraint_Error if the line is longer than S; Get_Line never raises Constraint_Error. This code never skips the line terminator; Get_Line skips the line terminator if the line is shorter than S. -- Jeffrey Carter