in reply to dumb question on exec and system ...

exec() replaces the current program by another one. Unless the exec fails to start the mentioned program, exec will not return..

system() calls another program, and then returns a status code (which contains the exit value of the program, and possibly information about signals). system() can be called in such a way that no shell will be used.

qx calls another program, and returns the output of that program. It's not under the programmers control whether a shell can be bypassed or not.

Both system and qx are implemented using fork and exec (at least, under Unix).

Abigail

  • Comment on Re: dumb question on exec and system ...

Replies are listed 'Best First'.
Re: Re: dumb question on exec and system ...
by iza (Monk) on Apr 16, 2004 at 08:47 UTC
    Thanks, it's a nice explanation - clear and short, sums up the doc wonderfully :)