comp.lang.ada
 help / color / mirror / Atom feed
* Using Posix with Apex
@ 1997-01-28  0:00 Paul Van Bellinghen
  1997-01-29  0:00 ` Matthew Heaney
  0 siblings, 1 reply; 4+ messages in thread
From: Paul Van Bellinghen @ 1997-01-28  0:00 UTC (permalink / raw)




 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.






^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~1997-02-10  0:00 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
1997-01-28  0:00 Using Posix with Apex Paul Van Bellinghen
1997-01-29  0:00 ` Matthew Heaney
1997-01-30  0:00   ` Dr. Peter E. Obermayer
1997-02-10  0:00     ` Robert Dewar

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox