comp.lang.ada
 help / color / mirror / Atom feed
From: matthew_heaney@acm.org (Matthew Heaney)
Subject: Re: Help: Get/Get_line
Date: 1998/05/16
Date: 1998-05-16T00:00:00+00:00	[thread overview]
Message-ID: <matthew_heaney-ya023680001605981834490001@news.ni.net> (raw)
In-Reply-To: 355E0DE6.6867@info.polymtl.ca


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.




  parent reply	other threads:[~1998-05-16  0:00 UTC|newest]

Thread overview: 11+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1998-05-16  0:00 Help: Get/Get_line John Slavich
1998-05-16  0:00 ` Tom Moran
1998-05-17  0:00   ` John Slavich
1998-05-17  0:00     ` Matthew Heaney
1998-05-17  0:00       ` John Slavich
1998-05-18  0:00         ` Dale Stanbrough
1998-05-16  0:00 ` Matthew Heaney [this message]
1998-05-20  0:00 ` christoph grein
1998-05-21  0:00   ` John J Cupak Jr, CCP
1998-05-22  0:00     ` Assistance: Get/Get_line Anonymous
1998-05-22  0:00     ` Help: Get/Get_line Dale Stanbrough
replies disabled

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