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,INVALID_MSGID, SYSADMIN autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,50b41333767ba40f,start X-Google-Attributes: gid103376,public From: pvanbell@cloud9.net (Paul Van Bellinghen) Subject: Using Posix with Apex Date: 1997/01/28 Message-ID: <32ee8e2c.1005715@NEWS.CLOUD9.NET>#1/1 X-Deja-AN: 212959381 organization: Cloud 9 Internet, White Plains, NY, USA newsgroups: comp.lang.ada Date: 1997-01-28T00:00:00+00:00 List-Id: I don't know how many of you are using Rational Apex, but if you are and want to write any code to extract arguments from a command line, I had a devel of a time doing it. I recently modified a program that counted lines of Ada code to take its two arguments (output file, input file list) from the command line. I was compiling it with Rational Apex and so I used the Posix package provided. In order to get say, the first argument on the command line, I wrote: Output_File_Name.Name := Posix.To_String (Posix.Value (Posix_Process_Environment.Argument_List, 2)); however, I kept getting an "invalid argument" exception when the code was executed. I called the Rational support team and found out that the line suld read Output_File_Name.Name (1 .. Posix.To_String (Posix.Value (Posix_Process_Environment.Argument_List, 2))' Length) := Posix.To_String (Posix.Value (Posix_Process_Environment.Argument_List, 2)); The problem was that Output_File_Name.Name and the argument to be assigned to it had different lengths. This is not allowed by Ada's rules for assigning to arrays - you must specify which elements of the array are to be assigned values when the right-hand-side is shorter than the left-hand-side.