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,9797292c79ff60c X-Google-Attributes: gid103376,public From: matthew_heaney@acm.org (Matthew Heaney) Subject: Re: Help: Get/Get_line Date: 1998/05/16 Message-ID: #1/1 X-Deja-AN: 353922253 Content-Transfer-Encoding: 8bit References: <355E0DE6.6867@info.polymtl.ca> Mime-Version: 1.0 Content-Type: text/plain; charset=ISO-8859-1 Organization: Network Intensive Newsgroups: comp.lang.ada Date: 1998-05-16T00:00:00+00:00 List-Id: In article <355E0DE6.6867@info.polymtl.ca>, jslavich@info.polymtl.ca wrote: (start of quote) number : integer; number2 : integer; name : string (1..50); ... begin get_line(name, number2); ... get(number); ... (end of quote) The value returned as the second value of Get_Line is called Last, and refers to the last index in that contains a valid value read in. It is prefered that you name that object last, as in declare Name : String (1 .. 50); Last : Natural; begin Get_Line (Name, Last); ... end; (end of quote) But when if I invert them, GNAT is not happy and it doesn't work: ... begin get(number); ... get_line(name, number2); ... What am I missing? (end of quote) What do you mean by "GNAT is not happy." Do you mean that the program wouldn't compile, or that it does compile, but runs with an exception, or runs but delivers incorrect results? It is difficult to provide help when you use non-technical descriptions as "not happy." And what is Get? Is it from Ada.Integer_Text_IO? Or some instantiation of Ada.Text_IO.Integer_IO? Or something else? If you're getting an exception during Get, it may mean that you're trying to enter a number that doesn't have the format required for an integer literal.