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-10 13:53:18 PST Path: archiver1.google.com!news1.google.com!newsfeed.stanford.edu!logbridge.uoregon.edu!arclight.uoregon.edu!wn4feed!wn1feed!worldnet.att.net!204.127.198.203!attbi_feed3!attbi.com!rwcrnsc53.POSTED!not-for-mail From: "Mark Lundquist" Newsgroups: comp.lang.ada References: <3C151B2C.4010601@oek.dk> Subject: Re: Command_Line question X-Priority: 3 X-MSMail-Priority: Normal X-Newsreader: Microsoft Outlook Express 5.50.4133.2400 X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400 Message-ID: NNTP-Posting-Host: E3aR7-170396-Yy-339137@rwcrnsc53 X-Complaints-To: abuse@attbi.com X-Trace: rwcrnsc53 1008021198 E3aR7-170396-Yy-339137@rwcrnsc53 (Mon, 10 Dec 2001 21:53:18 GMT) NNTP-Posting-Date: Mon, 10 Dec 2001 21:53:18 GMT Organization: AT&T Broadband Date: Mon, 10 Dec 2001 21:53:18 GMT Xref: archiver1.google.com comp.lang.ada:17719 Date: 2001-12-10T21:53:18+00:00 List-Id: "Peter I. Hansen" wrote in message news:3C151B2C.4010601@oek.dk... > 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); > 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 > Sort of... You have to give an actual for any parameter that does not have a default, and that includes all 'out' mode parameters. And for the purpose for which this overloading of Get is intended, the Last parameter is necessary -- that is, so that you know where to 'pick up where you left off' if you're going to continue parsing the string. That's why there isn't an overloading of Get that is like this but without the Last parameter. That said... for what you're doing, Integer_Text_IO is probably not the best way anyway. You'd probably find that using an integer type 'Value attribute convenient, e.g.: Num := Natural'Value (Ada.Command_Line.Argument (1)); -- mark