comp.lang.ada
 help / color / mirror / Atom feed
From: emery@grebyn.com (David Emery)
Subject: Re: Ada Equivalent of "system()" in C?
Date: 1996/04/16
Date: 1996-04-16T00:00:00+00:00	[thread overview]
Message-ID: <emery-1604961854590001@line029.nwm.mindlink.net> (raw)
In-Reply-To: 4l1dbi$pho@rational.rational.com

In article <4l1dbi$pho@rational.rational.com>, rlk@rational.com (Bob
Kitzberger) wrote:

> : I'm new to Ada programming, having come from a C background.  Is
> : there an equivalent in Ada of the "system()" function in C that
> : allows you execute an external program?
> 
> Take a look at the Posix Ada bindings -- likely provided by
> your compiler vendor.  The Posix Ada bindings are a standardized
> binding definition to Posix/Unix services.  Personally, I find
> the Posix bindings much nicer to use than using pragma Interface
> to the C library routines themselves.
> 
> --
> Bob Kitzberger        Rational Software Corporation       rlk@rational.com

The Unix function system() is not included in POSIX.1 or POSIX.5.  I 
believe that it is included in the POSIX.1a revision that is still in
development.

That being said, it's trivial to implement this via pragma interface.
The signature is, if I remember correctly (I'm at home and can't check
the manpage):
   int   system (const char * cmd);
In other words, this takes a single string parameter, the command to
execute, and returns an int value if the command was succesfully started.
Note that the return value is NOT the return value of the command, but
rather of the fork() that is used to set up execution of the command.

            dave




  reply	other threads:[~1996-04-16  0:00 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
1996-04-15  0:00 Ada Equivalent of "system()" in C? Dave Sparks
1996-04-16  0:00 ` Robert Dewar
1996-04-17  0:00   ` Samuel Tardieu
1996-04-17  0:00   ` Bob Kitzberger
1996-04-16  0:00     ` David Emery [this message]
1996-04-17  0:00       ` Robert Dewar
1996-04-22  0:00         ` Sandy Wise
1996-04-17  0:00       ` Keith Thompson
1996-04-19  0:00       ` Ron J Theriault
1996-04-16  0:00 ` Samuel Tardieu
replies disabled

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