comp.lang.ada
 help / color / mirror / Atom feed
* Q: Parse a line?
@ 1995-02-27 15:40 Kevin R.J. Ellwood
  1995-02-28 15:04 ` Kevin R.J. Ellwood
  1995-02-28 21:50 ` Tucker Taft
  0 siblings, 2 replies; 4+ messages in thread
From: Kevin R.J. Ellwood @ 1995-02-27 15:40 UTC (permalink / raw)


Hello,

I am fairly new to Ada and the book that I have didn't help with
this question.  What I need to do is to read a line in as a string
and then read some integer values from it.  In fortran I could
use an internal read statement to read from the string. Can anyone 
give a simple way of doing this in Ada?

Thanks
Kevin
--
//////////////////////////////////////////////////////////////////////////////
// Kevin R.J. Ellwood                      Phone: (313) 322-5535  (Work)    //
// Polymer Science Dept.                     Fax: (313) 337-5581            //
// Ford Research Laboratory                                                 //
// Dearborn, MI 48121-2153                 email: kevin@vangogh.srl.ford.com//
//////////////////////////////////////////////////////////////////////////////



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Q: Parse a line?
@ 1995-02-28 14:58 CONDIC
  0 siblings, 0 replies; 4+ messages in thread
From: CONDIC @ 1995-02-28 14:58 UTC (permalink / raw)


From: Marin David Condic, 407.796.8997, M/S 731-93
Subject: Re: Q: Parse a line?
Original_To:  PROFS%"SMTP@PWAGPDB"
Original_cc:  CONDIC



Kevin:

Just in case you haven't received a dozen answers for this already...

Check out LRM 14.3.8, par 17..23 if you're interested in real
numbers.

Here's an example:

with TEXT_IO ;
procedure FU is

    S   : constant STRING   := "   3.14159   " ;
    F   : FLOAT             := 0.0 ;
    L   : INTEGER           := 0 ;

    package
        BAR
    is new
        TEXT_IO.FLOAT_IO (
            NUM     => FLOAT ) ;
    use BAR ;

begin
    BAR.GET (
        FROM    => S,
        ITEM    => F,
        LAST    => L ) ;
end FU ;

Good luck with it.

Pax,
Marin

Marin David Condic, Senior Computer Engineer    ATT:        407.796.8997
M/S 731-93                                      Technet:    796.8997
Pratt & Whitney, GESP                           Internet:   CONDICMA@PWFL.COM
P.O. Box 109600                                 Internet:   MDCONDIC@AOL.COM
West Palm Beach, FL 33410-9600
===============================================================================
    Please send responses to one of the addresses in this trailer.
    A "reply" to the address in the message header will bounce.
===============================================================================
    "Don't say yes until I finish talking."

        -- Darryl F. Zanuck
===============================================================================



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Q: Parse a line?
  1995-02-27 15:40 Q: Parse a line? Kevin R.J. Ellwood
@ 1995-02-28 15:04 ` Kevin R.J. Ellwood
  1995-02-28 21:50 ` Tucker Taft
  1 sibling, 0 replies; 4+ messages in thread
From: Kevin R.J. Ellwood @ 1995-02-28 15:04 UTC (permalink / raw)


Hello,

I would like to thank all those that replied to my question. I received
so many helpful responses that a followup post was the only way to thank
everyone.

Kevin
--
//////////////////////////////////////////////////////////////////////////////
// Kevin R.J. Ellwood                      Phone: (313) 322-5535  (Work)    //
// Polymer Science Dept.                     Fax: (313) 337-5581            //
// Ford Research Laboratory                                                 //
// Dearborn, MI 48121-2153                 email: kevin@vangogh.srl.ford.com//
//////////////////////////////////////////////////////////////////////////////



^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: Q: Parse a line?
  1995-02-27 15:40 Q: Parse a line? Kevin R.J. Ellwood
  1995-02-28 15:04 ` Kevin R.J. Ellwood
@ 1995-02-28 21:50 ` Tucker Taft
  1 sibling, 0 replies; 4+ messages in thread
From: Tucker Taft @ 1995-02-28 21:50 UTC (permalink / raw)


Kevin R.J. Ellwood (kevin@vangogh.srl.ford.com) wrote:

: I am fairly new to Ada and the book that I have didn't help with
: this question.  What I need to do is to read a line in as a string
: and then read some integer values from it.  In fortran I could
: use an internal read statement to read from the string. Can anyone 
: give a simple way of doing this in Ada?

Try the Integer_IO.Get that reads from a String, or use 'Image.

: // Kevin R.J. Ellwood                      Phone: (313) 322-5535  (Work)    //
: // Ford Research Laboratory                                                 //
: // Dearborn, MI 48121-2153                 email: kevin@vangogh.srl.ford.com//

-Tucker Taft  stt@inmet.com



^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1995-02-28 21:50 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1995-02-27 15:40 Q: Parse a line? Kevin R.J. Ellwood
1995-02-28 15:04 ` Kevin R.J. Ellwood
1995-02-28 21:50 ` Tucker Taft
  -- strict thread matches above, loose matches on Subject: below --
1995-02-28 14:58 CONDIC

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