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=-1.3 required=5.0 tests=BAYES_00,INVALID_MSGID autolearn=no autolearn_force=no version=3.4.4 X-Google-Language: ENGLISH,ASCII-7-bit X-Google-Thread: 103376,a33ec7badc330d9e X-Google-Attributes: gid103376,public From: dewar@cs.nyu.edu (Robert Dewar) Subject: Re: Ada Equivalent of "system()" in C? Date: 1996/04/17 Message-ID: #1/1 X-Deja-AN: 150388333 references: <4l1dbi$pho@rational.rational.com> organization: Courant Institute of Mathematical Sciences newsgroups: comp.lang.ada Date: 1996-04-17T00:00:00+00:00 List-Id: Dave Emery said "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." However, it *is* in fact in the ANSI C standard, although the semantics are pretty much entirely implementation defined. In general the Ada standard library avoids functions that cannot be well defined in a portable manner, although, to be honest, the command line interface is pretty much in this category already. Anyway, Peter's recipe for interfacing to C is certainly one approach. If you are using GNAT, you could also use GNAT.OS_Lib.Spawn. Spawn is a routine in the GNAT supplied predefined package GNAT.OS_Lib which has a handful of useful operating systems interfaces (it is the interface used by the GNAT compiler itself). Here is the documentatoin from the spec: procedure Spawn (Program_Name : String; Args : Argument_List; Success : out Boolean); -- The first parameter of function Spawn is the full path name of the -- executable. The second parameter contains the arguments to be passed -- to the program. Success is false if the program could not be spawned -- or its execution completed unsuccessfully. Note that the caller will -- be blocked until the execution of the spawned program is complete.