comp.lang.ada
 help / color / mirror / Atom feed
From: johnherro@aol.com (John Herro)
Subject: Re: HELP NEEDED !! URGENT !!
Date: 1999/02/22
Date: 1999-02-22T00:00:00+00:00	[thread overview]
Message-ID: <19990222093955.21207.00000818@ngol04.aol.com> (raw)
In-Reply-To: 7arl83$qac$1@wolfenstein.adesium-services.fr


<pierre.blanchou@aliso.com> writes:
> Could someone tell me how I can ... do input/output
> on an object of type TIME of the package Ada.Calendar_IO ?

Since type Time is private and the package Ada.Calendar_IO provides no
input/output functions, you can't directly input or output objects of type
Time.  However, you can use procedure Split to convert an object of type Time
to into Year (type Integer), Month (type Integer), Day (type Integer), and
Seconds (type Duration, a fixed-point type).  You can then output these types. 
For example, if Y is the Year, you can write
Ada.Text_IO.Put(Integer'Image(Y));.

For input, you can input the Year, Month, Day, and Seconds, and then use
function Time_Of to convert to an object of type Time.  The easiest way to
input the Year, for example, is to use Get_Line and then convert the String to
the Year.  For example,
S   : String(1 .. 80);
Len : Natural;
Y   : Ada.Calendar.Year_Number;
...
Ada.Text_IO.Get_Line(Item => S, Last => Len);
Y := Integer'Value(S(1 .. Len));

I hope this helps.

- John Herro
You can download a shareware AdaTutor program at
http://members.aol.com/AdaTutor




  reply	other threads:[~1999-02-22  0:00 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1999-02-22  0:00 HELP NEEDED !! URGENT !! Pierre
1999-02-22  0:00 ` John Herro [this message]
1999-02-22  0:00 ` dennison
replies disabled

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