[comp.unix.wizards] C-Execute-Command

georg@SunLab13.essex.ac.uk (Georgatos G) (12/01/89)

     Does anybody know how to call an executable file from a C-program ? 
     I am using the Unix CC compiler.
 

                                                                   Hgg89.

jik@athena.mit.edu (Jonathan I. Kamens) (12/03/89)

In article <2614@servax0.essex.ac.uk> georg@essex.ac.uk writes:

>     Does anybody know how to call an executable file from a C-program ? 
>     I am using the Unix CC compiler.

  Try looking at the man pages for execve(2), execl(3) and system(3).

  This is the kind of question that almost undoubtedly belongs in the
comp.unix.questions newsgroup, not comp.unix.wizards, because it is a
simple question that is answered directly by an available man page.
Questions should be asked in Comp.unix.wizards only if you are really
sure they are "wizard-level" questions, or if you have asked in
comp.unix.questions, waited a few days, and still not received any
answers (although that probably won't happen).

  Furthermore, as the monthly posting to comp.unix.questions points
out, there is almost undoubtedly someone at your site who could have
answered this question.  You should try to avoid posting questions to
the entire net that could be answered easily by someone at your site.

Jonathan Kamens			              USnail:
MIT Project Athena				11 Ashford Terrace
jik@Athena.MIT.EDU				Allston, MA  02134
Office: 617-253-8495			      Home: 617-782-0710

woody@rpp386.cactus.org (Woodrow Baker) (12/04/89)

In article <2614@servax0.essex.ac.uk>, georg@SunLab13.essex.ac.uk	 (Georgatos G) writes:
> 
> 
>      Does anybody know how to call an executable file from a C-program ? 
>      I am using the Unix CC compiler.
>  
> 
>                                                                    Hgg89.

Seems that there is a function in most c compilers called execl or execle
or execlp or execv etc that does this nicely.  Fork seems to it do it also.

woody@rpp386.cactus.org (Woodrow Baker) (12/05/89)

In article <17401@rpp386.cactus.org>, woody@rpp386.cactus.org (Woodrow Baker) writes:
> In article <2614@servax0.essex.ac.uk>, georg@SunLab13.essex.ac.uk	 (Georgatos G) writes:
> > 
> > 
> >      Does anybody know how to call an executable file from a C-program ? 
> >      I am using the Unix CC compiler.
> >  
> > 
> >                                                                    Hgg89.
> 
> Seems that there is a function in most c compilers called execl or execle
> or execlp or execv etc that does this nicely.  Fork seems to it do it also.
> 

I heard from a lot of people on this one.  I think a question deserves an 
answer regardless of the level of the questioner.  Just because this is 
unix.wizards, is no justification for the tone of some messages that I got
and that I have seen posted.  I peruse this discussion, because I work in 
an MS-DOS world, and have a need to learn some about unix.  I have a XENIX
system at home...on a hard disk...setting on my bookshelf...problably
where it will stay for a while, as I can't find tools that even begin to approach
what I have in the MS-DOS world, I know, go flame somewhere else....
It turns out that the compiler that I use has a function called fork
that DOES NOT make a copy of the calling program.  It DOES pass a command
line to an external program and invoke it.  (either a .com or .exe (ms-dos))
file, and returns control back to the calling program.  The compiler is
a rather old 'C' compiler, and is apparently not unix compliant.  I use the 
fork function of my compiler in all the versions of the RLL compiler that
I maintain and work.

chrisc@astroatc.UUCP (Chris Czerwinski) (12/09/89)

In article <2614@servax0.essex.ac.uk> georg@essex.ac.uk writes:
>
>
>     Does anybody know how to call an executable file from a C-program ? 
>     I am using the Unix CC compiler.
> 
>
>                                                                   Hgg89.
As they say in news.announce.newusers (something you obviousely haven't
looked at)....RTFM! This question can easily be answered in the man pages 
or your sys admin... For those who don't know RTFM, Read The F***ing
Manual.

                         Astronautics Corporation of America              
             __                    __
            /  ' /       *        /  '                 *         /   *
           /    /_  __  , _      /   __  _  __  , , __, __  _   /_/ ,
          (____/ /_/ (_/_/_)_   (_____/_(<_/ (_/_/_/ /_/ /_/_)_/ \_/__
          Chris Czerwinski          /| Quality Assurance
          <chrisc@astroatc>    	   |/  ACA - Corporate Headquarters