Chinaunix首页 | 论坛 | 博客
  • 博客访问: 97908
  • 博文数量: 27
  • 博客积分: 550
  • 博客等级: 下士
  • 技术积分: 240
  • 用 户 组: 普通用户
  • 注册时间: 2011-01-20 10:47
文章分类
文章存档

2014年(1)

2011年(26)

分类: C/C++

2011-09-29 09:40:56

#include
main()
{
    if(vfork() ==0)
    {
        printf(“This is the child process\n”);
    }else{
        printf(“This is the parent process\n”);
    }
}

这段代码编译运行完,在最后报了一个segment fault 的错误,在最后加上exit(1)就没报了, 为何呢?
还不明原因
 
#include
main()
{
    if(vfork() ==0)
    {
        printf(“This is the child process\n”);
    }else{
        printf(“This is the parent process\n”);
    }
    exit(1);
}

阅读(1210) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~