www.delorie.com/archives/browse.cgi   search  
Mail Archives: djgpp/1999/08/18/12:10:30

Date: Wed, 18 Aug 1999 09:57:04 -0400
Message-Id: <199908181357.JAA05982@envy.delorie.com>
From: DJ Delorie <dj AT delorie DOT com>
To: djgpp AT delorie DOT com
In-reply-to: <7pdhog$glp$1@server.noris.net> (ykgoh@email.com)
Subject: Re: What's the difference between system, spawn and exec?
References: <7pdhog$glp$1 AT server DOT noris DOT net>
Reply-To: djgpp AT delorie DOT com
X-Mailing-List: djgpp AT delorie DOT com
X-Unsubscribes-To: listserv AT delorie DOT com

> The functions, system(), spawn() and exec() are used to execute
> other programs or commands. So what's the difference between them?

system() interprets an entire command line, including pipes,
redirection, etc.  It does this by running the command interpreter
(command.com or sh.exe) so there's overhead, but it's flexible.

spawn and exec run one specific binary executable with a specific set
of arguments, which are not interpreted at all.  The only difference
between spawn and exec is that spawn returns to the calling program
when the child is done, while exec does not.

- Raw text -


  webmaster     delorie software   privacy  
  Copyright © 2019   by DJ Delorie     Updated Jul 2019