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/17 Message-ID: #1/1 X-Deja-AN: 353980870 Content-Transfer-Encoding: 8bit References: <355E0DE6.6867@info.polymtl.ca> <355e2708.30001755@SantaClara01.news.InterNex.Net> <355E79FE.448@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-17T00:00:00+00:00 List-Id: In article <355E79FE.448@info.polymtl.ca>, jslavich@info.polymtl.ca wrote: (start of quote) My problem is when I need to invert the "get" and "get_line" like so: ... begin get(number); ... get_line(name, number2); ... end xx; At the first prompt I enter an integer and as soon as I hit the return key, it skips over the "get_line" command and doesn't prompt me to enter a string. I get no error from the "get_line" command. (end of quote) Here's your problem: When you press Return to enter the value of Number at the prompt, Get reads in and parses only the number itself, not the carriage return. What happens is that when you say Get_Line, the carriage return is still there, and it reads _that_ one, instead of the one you want. What you need to do is just add a statement that consumes the rest in the line, including the carriage return, and then do the Get_Line. So just add a Skip_Line immediately following Get. The code belows compiles and works as expected, using GNAT 3.10p under UNIX. Hope that helps, Matt --STX with Ada.Integer_Text_IO; with Ada.Text_IO; procedure Test_IO is Name : String (1 .. 50); Last : Natural; I : Integer; begin Ada.Integer_Text_IO.Get (I); --!!! Here's the new line: Ada.Text_IO.Skip_Line; Ada.Text_IO.Get_Line (Name, Last); Ada.Text_IO.Put_Line ("I is" & I'Img); Ada.Text_IO.Put_Line ("Name is '" & Name (1 .. Last) & "'"); end;