Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Using command-line arguments

193 views
Skip to first unread message

Kai Glsner

unread,
Apr 10, 2000, 3:00:00 AM4/10/00
to
Hello Community,

I have a question concerning the usage of command-line arguments in Ada. For
the start I try to give my main-routine two integer-values using
Ada.Command_Line.Argument (). But this function gives back a string...

How can I deal with strings (or options), integers and floats as
command-line arguments

Thanks in advance for the answer.

Kai Glaesner

Gisle Sælensminde

unread,
Apr 10, 2000, 3:00:00 AM4/10/00
to

with ada.command_line;
with ada.text_io; use ada.text_io;

procedure test is
begin
put_line(Integer'value(ada.command_line.argument(1)));
put_line(Integer'value(ada.command_line.argument(2)));
end;


--
--
Gisle Sælensminde ( gi...@ii.uib.no )

ln -s /dev/null ~/.netscape/cookies

Gisle Sælensminde

unread,
Apr 10, 2000, 3:00:00 AM4/10/00
to
In article <slrn8f3511...@struts.ii.uib.no>, Gisle Sælensminde wrote:
>In article <8crv0s$e58$1...@news.sns-felb.debis.de>, Kai Glsner wrote:
>>Hello Community,
>>
>>I have a question concerning the usage of command-line arguments in Ada. For
>>the start I try to give my main-routine two integer-values using
>>Ada.Command_Line.Argument (). But this function gives back a string...
>>
>>How can I deal with strings (or options), integers and floats as
>>command-line arguments
>>
>>Thanks in advance for the answer.
>
>with ada.command_line;
>with ada.text_io; use ada.text_io;
>
>procedure test is
>begin
> put_line(Integer'value(ada.command_line.argument(1)));
> put_line(Integer'value(ada.command_line.argument(2)));
>end;

Sorry, my mind collapsed for a moment. The contents of put_line
was correct, but put_line only takes strings as parameters.
The example under is hopefully better. It compiles at least.

with ada.command_line;
with ada.text_io; use ada.text_io;

procedure test is

A, B : integer

begin
A := Integer'value(ada.command_line.argument(1));
B := Integer'value(ada.command_line.argument(2));

Kai Glsner

unread,
Apr 10, 2000, 3:00:00 AM4/10/00
to
Thank you very much,

I never thought that something can be so simlpe in Ada....;-)

Kai

Gisle Slensminde schrieb in Nachricht ...
>In article <slrn8f3511...@struts.ii.uib.no>, Gisle Slensminde

>Gisle Slensminde ( gi...@ii.uib.no )
>
>ln -s /dev/null ~/.netscape/cookies

Marin D. Condic

unread,
Apr 10, 2000, 3:00:00 AM4/10/00
to
Kai Glsner wrote:
> I never thought that something can be so simlpe in Ada....;-)
>
Usually, there is a simple way to do most things in Ada. It just
requires some experience with the language. You might try looking at the
Adapower website (www.adapower.com) for additional help & examples of
how to do various things.

MDC
--
======================================================================
Marin David Condic - Quadrus Corporation - http://www.quadruscorp.com/
Send Replies To: m c o n d i c @ q u a d r u s c o r p . c o m
Visit my web site at: http://www.mcondic.com/

"I'd trade it all for just a little more"
-- Charles Montgomery Burns, [4F10]
======================================================================

0 new messages