comp.lang.ada
 help / color / mirror / Atom feed
From: Simon Wright <simon@pushface.org>
Subject: Re: Reading text files with different data types
Date: 10 May 2004 06:41:04 +0100
Date: 2004-05-10T06:41:04+01:00	[thread overview]
Message-ID: <x7vvfj44z67.fsf@smaug.pushface.org> (raw)
In-Reply-To: 6e837805.0405091609.bb1a850@posting.google.com

yorkbiatch@hotmail.com (Isa) writes:

> I'm trying to write a program to read points from a text file into
> an array of records.

> Each record corresponds to a line in the file, consisting of an
> alphanumberic 6 character line, a space, a floating point number,
> another space, then a final floating point number. (a name and 2
> coordinates).

> I'm completely at a loss as to how to read this in -- Ada.text_IO
> can read it fine as a string - but I need to do calculation on the
> floating point numbers(which could be with or without decimal
> points, largest number to be stored 1000.00)

Try splitting the input line at the spaces and then the
type-name'Value attribute:

  X : Float;

  X := Float'Value ("123.456");

-- 
Simon Wright                               100% Ada, no bugs.



      parent reply	other threads:[~2004-05-10  5:41 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2004-05-10  0:09 Reading text files with different data types Isa
2004-05-10  2:21 ` Jeff C,
2004-05-10  5:41 ` Simon Wright [this message]
replies disabled

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