Difference between using fork/execvp and system call

前端 未结 5 1114
小鲜肉
小鲜肉 2021-02-07 12:13

What is the difference between using system() to execute a binary and using the combination of fork/execvp.

Is there any security/portablility/performance difference.

5条回答
  •  后悔当初
    2021-02-07 12:44

    system() works on Windows but fork() doesn't.

    Unless you use a compatibility layer such as Cygwin, but even then a fork can be very expensive.

提交回复
热议问题