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=-0.9 required=5.0 tests=BAYES_00,FORGED_GMAIL_RCVD, FREEMAIL_FROM autolearn=no autolearn_force=no version=3.4.4 X-Google-Thread: 103376,782af4edeb84c4b7 X-Google-Attributes: gid103376,public X-Google-Language: ENGLISH,ASCII-7-bit Path: g2news2.google.com!postnews.google.com!e3g2000cwe.googlegroups.com!not-for-mail From: "markww" Newsgroups: comp.lang.ada Subject: Re: basic basic ada question Date: 19 Oct 2006 08:45:20 -0700 Organization: http://groups.google.com Message-ID: <1161272720.704725.208180@e3g2000cwe.googlegroups.com> References: <1161268231.345231.242170@m73g2000cwd.googlegroups.com> <1qy643kz9ktss$.12j6z88wjcte2$.dlg@40tude.net> NNTP-Posting-Host: 67.154.89.221 Mime-Version: 1.0 Content-Type: text/plain; charset="iso-8859-1" X-Trace: posting.google.com 1161272726 22040 127.0.0.1 (19 Oct 2006 15:45:26 GMT) X-Complaints-To: groups-abuse@google.com NNTP-Posting-Date: Thu, 19 Oct 2006 15:45:26 +0000 (UTC) In-Reply-To: <1qy643kz9ktss$.12j6z88wjcte2$.dlg@40tude.net> User-Agent: G2/1.0 X-HTTP-UserAgent: Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; SV1; .NET CLR 1.1.4322; .NET CLR 2.0.50727),gzip(gfe),gzip(gfe) Complaints-To: groups-abuse@google.com Injection-Info: e3g2000cwe.googlegroups.com; posting-host=67.154.89.221; posting-account=cNKOMg0AAADT2ug8oGSYYXo8bsDvrHzw Xref: g2news2.google.com comp.lang.ada:7046 Date: 2006-10-19T08:45:20-07:00 List-Id: Ok, am I understanding this correctly - if I just '#include" the command line package: with Ada.Command_Line; use Ada.Command_Line; then the package defines the functions: function Argument_Count return Natural; function Argument (Number : in Positive) return String; for me which I can use from then on? So in my little app I can just use them like: Number_Of_Elements := Argument(0); (assuming the 0th argument is the # of elements to allocate...) Thanks; On Oct 19, 11:11 am, "Dmitry A. Kazakov" wrote: > On 19 Oct 2006 07:30:31 -0700, markww wrote: > > > Can someone give me an example of a command line app where I can read > > in command line arguments?See the package Ada.Command_Line. > > > In C++ we have: > > > int main(int argc, char **argv) > > { > > printf("There are [%i] arguments.\n", argc); > > return 0; > > } > > > all I have so far in ada is: > > > with Ada.Text_IO; use Ada.Text_IO; > > procedure DynamicArray is type Array_Of_Integers is array (Integer range <>) of Integer; > -- Not necessary, but a good style. You might need a subprogram > -- dealing with your arrays later. > Number_Of_Elements : Natural; > > > begin > > > -- Tell the user what we're doing. > > Put_Line ("This application will allocate a dynamic array."); Number_Of_Elements := ...; -- use Ada.Command_Line > > > -- Now allocate a dynamic array. > > Name : array (0 .. 20) of INTEGER declare > My_Array : Array_Of_Integers (1..Number_Of_Elements); > begin > -- Do with My_Array what you have to > end; > > > -- That's it. > > > end DynamicArray; > > > eventually I'd like to allocate that array based on the number of > > elements passed as an argument by the user.-- > Regards, > Dmitry A. Kazakovhttp://www.dmitry-kazakov.de