当前位置: 技术问答>linux和unix
fork()后文件描述符复制给子进程吗?
来源: 互联网 发布时间:2015-09-18
本文导语: void main(){ int fd = open(tmp,O_CREAT | O_WRONLY, 0644); if ((pid = fork ()) > 0) exit (0); else if (pid 0) exit (0); //在此父进程退出 else if (pid
void main(){
int fd = open(tmp,O_CREAT | O_WRONLY, 0644);
if ((pid = fork ()) > 0)
exit (0);
else if (pid 0)
exit (0);
//在此父进程退出
else if (pid
int fd = open(tmp,O_CREAT | O_WRONLY, 0644);
if ((pid = fork ()) > 0)
exit (0);
else if (pid 0)
exit (0);
//在此父进程退出
else if (pid