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.3 required=5.0 tests=BAYES_00, REPLYTO_WITHOUT_TO_CC 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!news3.google.com!border1.nntp.dca.giganews.com!nntp.giganews.com!newsfeed00.sul.t-online.de!t-online.de!newsfeed.freenet.de!newsfeed01.chello.at!newsfeed.arcor.de!newsspool1.arcor-online.net!news.arcor.de.POSTED!not-for-mail From: "Dmitry A. Kazakov" Subject: Re: basic basic ada question Newsgroups: comp.lang.ada User-Agent: 40tude_Dialog/2.0.15.1 MIME-Version: 1.0 Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Reply-To: mailbox@dmitry-kazakov.de Organization: cbb software GmbH References: <1161268231.345231.242170@m73g2000cwd.googlegroups.com> Date: Thu, 19 Oct 2006 17:11:45 +0200 Message-ID: <1qy643kz9ktss$.12j6z88wjcte2$.dlg@40tude.net> NNTP-Posting-Date: 19 Oct 2006 17:11:46 CEST NNTP-Posting-Host: e0b4448f.newsspool1.arcor-online.net X-Trace: DXC=;dem0XI7XG\I?44J>Z[:RQic==]BZ:af^4Fo<]lROoRQ^YC2XCjHcbY]QnSO56USP\DNcfSJ;bb[UFCTGGVUmh?TN\HXHJ4e80^J;R0ZRSmXZX X-Complaints-To: usenet-abuse@arcor.de Xref: g2news2.google.com comp.lang.ada:7045 Date: 2006-10-19T17:11:46+02:00 List-Id: 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. Kazakov http://www.dmitry-kazakov.de