Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl: the Markov chain saw

Re: Equivalence of System Call in C/C++

by jesuashok (Curate)
on May 25, 2007 at 09:03 UTC ( #617436=note: print w/replies, xml ) Need Help??

in reply to Equivalence of System Call in C/C++

C and C++ also got 'system' function in it. you can also use execl* family functions which are available in stdlib.h
  • Comment on Re: Equivalence of System Call in C/C++

Replies are listed 'Best First'.
Re^2: Equivalence of System Call in C/C++
by Tanktalus (Canon) on May 28, 2007 at 20:27 UTC

    Note that the OP asked about system, which maps conveniently to C's system function (although the perl one may have more magic, I don't remember what it is offhand - looking for shell metacharacters, auto-splitting, etc., I believe). Not about exec, which maps to the exec* functions in C, which does something very, very different. So different, in fact, that bringing it up without extra qualifiers is tantamount to intentionally misleading the poor OP.

    In fact, I would even go as far as to say that the differences between system and exec are greater than their similarities, and that they're merely tangentially related. cf., for vs foreach or for/foreach vs map in void context (but some of us don't do that). Very similar (identical!) semantics for these, but system and exec are so completely different...

Re^2: Equivalence of System Call in C/C++
by ikegami (Pope) on May 29, 2007 at 00:09 UTC

    On some systems, system would be implemented using fork, exec* and waitpid. exec* alone would not be equivalent, and it wouldn't be as portable. (Windows can't fork and I think it can't exec.)

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: note [id://617436]
and all is quiet...

How do I use this? | Other CB clients
Other Users?
Others meditating upon the Monastery: (4)
As of 2018-04-19 18:08 GMT
Find Nodes?
    Voting Booth?