|
发表于 2003-6-15 15:55:52
|
显示全部楼层
你再看看我的源代码:- #include <unistd.h>
- #include <stdio.h>
- main()
- {
- int i,j;
- int pid1,pid2;
- for(i=0;i<2;i++)
- {
- switch (i)
- {
- case 0:{if((pid1=fork())==-1) perror("fork error!");
- else
- if(pid1==0)
- printf("This is the first procedure!\n");
- exit(0);break;}
- case 1:{if((pid2=fork())==-1) perror("fork error!");
- else
- if(pid2==0)
- printf("This is the second procedure!");
- exit(0);break;}
- }
- }
- }
复制代码 但运行后,只有一个This is the first procedure!
怎么回事啊?第二个怎么没有打印出来呢? |
|