From mboxrd@z Thu Jan 1 00:00:00 1970 X-Spam-Checker-Version: SpamAssassin 3.4.4 (2020-01-24) on polar.synack.me X-Spam-Level: X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00 autolearn=ham autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,b623fee799cb68b3 X-Google-Attributes: gid103376,public X-Google-ArrivalTime: 2001-12-11 04:26:17 PST Path: archiver1.google.com!news1.google.com!sn-xit-02!supernews.com!news.tele.dk!small.news.tele.dk!news.tele.dk!not-for-mail Message-ID: <3C15FB6A.4070805@oek.dk> Date: Tue, 11 Dec 2001 13:26:18 +0100 From: "Peter I. Hansen" User-Agent: Mozilla/5.0 (X11; U; FreeBSD i386; en-US; rv:0.9.6) Gecko/20011121 X-Accept-Language: en-us MIME-Version: 1.0 Newsgroups: comp.lang.ada Subject: Re: Command_Line question References: <3C151B2C.4010601@oek.dk> <3C152834.F1B1850F@avercom.net> Content-Type: text/plain; charset=us-ascii; format=flowed Content-Transfer-Encoding: 7bit Organization: TDC Internet NNTP-Posting-Host: 195.215.62.2 X-Trace: 1008073576 dread05.news.tele.dk 25392 195.215.62.2 X-Complaints-To: abuse@post.tele.dk Xref: archiver1.google.com comp.lang.ada:17742 Date: 2001-12-11T13:26:18+01:00 List-Id: 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