From: "John J Cupak Jr, CCP" <jcj@swl.msd.ray.com>
Subject: Re: Help: Get/Get_line
Date: 1998/05/21
Date: 1998-05-21T00:00:00+00:00 [thread overview]
Message-ID: <35645664.2AE1A75A@swl.msd.ray.com> (raw)
In-Reply-To: 356231EB.3F2@eurocopter.de
[-- Attachment #1: Type: text/plain, Size: 1080 bytes --]
Christoph Grein has pointed out the problem with using Get to read
an Integer number from the input stream, as opposed to using Get_Line
to read the entire line.
In the Ada classes I teach, I recommend that the students use
Skip_Line to ignore everything after the initial input:
Get(Number); -- Read Integer number
Skip_Line; -- Discard remainder of input buffer
Alternatively, if you use Get_Line(Line, Size) to read in the
entire line, then you can use the Integer Get from a string to
extract just the integer part (See RM A.10.8(15-16)):
Get_Line(Line, Size);
Get(From => Line(1..Size), Item => Number, Last => Last);
Hope this helps! (And that I didn't make any misteaks!)
--
--------------------------------------------------------------
- John J. Cupak Jr, CCP -
- Raytheon Systems Company - Software Engineering Laboratory -
- tel: 978-858-1222 email (work): jcj@swl.msd.ray.com -
- fax: 978-858-4336 email (home): jcupak@aol.com -
--------------------------------------------------------------
[-- Attachment #2: Card for Cupak Jr, CCP, John J. --]
[-- Type: text/x-vcard, Size: 520 bytes --]
begin: vcard
fn: John J. Cupak Jr, CCP
n: Cupak Jr, CCP;John J.
org: Raytheon System Company / SEL Training
adr;dom: 50 Apple Hill Road;;MS T3MN35;Tewksbury;MA;01879;
email;internet: jcj@swl.msd.ray.com
title: Senior Software Engineer / Instructor
tel;work: 978-858-1222
tel;fax: 978-858-4336
tel;home: 603-595-8240
note: EMAIL;AOL:jcupak@aol.com
x-mozilla-cpt: ;0
x-mozilla-html: TRUE
version: 2.1
end: vcard
next prev parent reply other threads:[~1998-05-21 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
1998-05-20 0:00 ` christoph grein
1998-05-21 0:00 ` John J Cupak Jr, CCP [this message]
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