Can we start a background process using exec() giving & as an argument?

前端 未结 3 961
情话喂你
情话喂你 2021-01-18 13:34

If not, how can we start a background process in C?

3条回答
  •  离开以前
    2021-01-18 14:27

    Fork returns the PID of the child, so the common idiom is:

    if(fork() == 0)
        // I'm the child
        exec(...)
    

提交回复
热议问题