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=-0.4 required=5.0 tests=AC_FROM_MANY_DOTS,BAYES_00 autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,5a8b3d7ed8d4ae38 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2002-09-27 12:51:17 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!news-spur1.maxwell.syr.edu!news.maxwell.syr.edu!news-out.nuthinbutnews.com!propagator2-sterling!news-in-sterling.newsfeed.com!news-in.nuthinbutnews.com!cyclone1.gnilink.net!spamfinder.gnilink.net!nwrddc01.gnilink.net.POSTED!53ab2750!not-for-mail From: "Frank J. Lhota" Newsgroups: comp.lang.ada References: Subject: Re: Problem with Get_Line X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 6.00.2800.1106 X-MimeOLE: Produced By Microsoft MimeOLE V6.00.2800.1106 Message-ID: Date: Fri, 27 Sep 2002 19:51:15 GMT NNTP-Posting-Host: 141.157.178.79 X-Complaints-To: abuse@verizon.net X-Trace: nwrddc01.gnilink.net 1033156275 141.157.178.79 (Fri, 27 Sep 2002 15:51:15 EDT) NNTP-Posting-Date: Fri, 27 Sep 2002 15:51:15 EDT Xref: archiver1.google.com comp.lang.ada:29389 Date: 2002-09-27T19:51:15+00:00 List-Id: The problem with this program is the way it manages the input stream. When an integer is read from the input stream, as is done with the call Get(Opc); the I/O routine skips leading white space (if any), then reads in characters that can be used to represent an integer. No characters past the integer are removed from the input stream. Now assume that the user presses the '1' key followed by the enter key. Then the input stream will have 1 where is the end-of-line marker. After the "Get(Opc)" call, Opc is set to 1 and the input stream will contain If you call Get_Line at this point, then it will correctly see that there is an empty line in the input stream, and return an indcation of that fact. That is precisely what is happening in your program. This is not really an Ada issue, mistakes like this are also made in C. After the "Get(Opc)" call, add a call to the Ada.Text_Io procedure Skip_Line to discard the characters up to and including the next end-of-line marker.