to system() or fork()/exec()?

前端 未结 4 1278
不思量自难忘°
不思量自难忘° 2020-12-16 15:25

There appear to be two common ways of running an external executable from C in unix, the

system()

call and

pid = fork()
sw         


        
4条回答
  •  -上瘾入骨i
    2020-12-16 15:36

    Going via system() additionally invokes a shell process, which might not be what you want.

    Also the calling process is notified only when such shell dies not when the actual process run by the shell died.

提交回复
热议问题