Chinaunix首页 | 论坛 | 博客
  • 博客访问: 411919
  • 博文数量: 93
  • 博客积分: 6000
  • 博客等级: 准将
  • 技术积分: 1052
  • 用 户 组: 普通用户
  • 注册时间: 2008-03-19 11:01
文章分类

全部博文(93)

文章存档

2011年(1)

2009年(26)

2008年(66)

我的朋友

分类: LINUX

2008-12-24 10:19:18

#include
#include
#include

int main(void)
{
    pid_t pid ;
    if((pid=fork())<0)
        {
            printf("fork error!\n");
            exit(1);
        }
    else if(pid==0)
        {
            printf("Child process is printing.\n");
        }
    else
        {
            printf("Parent process is printing.\n");
        }
    exit(0);    
}

使用gcc -o test.out *.c 命令编译的时候出现 warning:no newline at end of file的警告。
其原因是有些gcc就要求在程序最后一行(main函数的回括号之后)加个回车。如果没有这个回车就会出现上述的警告。但是也会生成.out文件。
阅读(1818) | 评论(0) | 转发(0) |
给主人留下些什么吧!~~