From: "Peter I. Hansen" <pih@oek.dk>
Subject: Re: Command_Line question
Date: Tue, 11 Dec 2001 13:26:18 +0100
Date: 2001-12-11T13:26:18+01:00 [thread overview]
Message-ID: <3C15FB6A.4070805@oek.dk> (raw)
In-Reply-To: 3C152834.F1B1850F@avercom.net
Tucker Taft wrote:
>"Peter I. Hansen" wrote:
>
>>Hello
>>
>>I'm new to Ada95, and I'm trying to write a program which needs to read
>>arguments from the command line. I found out that the Command_Line
>>package is the way to go, but something i don't get. for example if I
>>have this code :
>>
>>WITH Ada.Text_IO;
>>WITH Ada.Command_Line;
>>WITH Ada.Integer_Text_IO;
>>
>>PROCEDURE Test IS
>>
>>Num : Natural ;
>>NumLength : Natural ;
>>
>>BEGIN -- Test
>> Ada.Integer_text_IO.Get( From => Ada.Command_Line.Argument(Number => 1),
>> Item => Num,
>> Last => NumLenght);
>>
>
>Generally, it is easier to use "Integer'Value(blah)" than "Integer_Text_IO.Get(...)".
>Integer_Text_IO gives you more control, but Integer'Value is usually adequate.
>So you could change this to:
>
> Num := Integer'Value(Ada.Command_Line.Argument(Number => 1));
>
This is just what I'm looking for. This notation is not in my Ada95 book.
>> Ada.Integer_Text_IO.Put(Item => Num);
>>
>>END Test;
>>
>>The question is : Is there a way to do this whitout the 'NumLength'
>>variable, or is this just the way things work ?
>>
>>/Peter
>>
>
Thanks
/Peter
next prev parent reply other threads:[~2001-12-11 12:26 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2001-12-10 20:29 Command_Line question Peter I. Hansen
2001-12-10 21:25 ` Tucker Taft
2001-12-11 6:57 ` Anders Wirzenius
2001-12-11 12:26 ` Peter I. Hansen [this message]
2001-12-10 21:53 ` Mark Lundquist
2001-12-11 13:03 ` Marc A. Criley
replies disabled
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox