我写了一个程序Linux的fork()的命令
#include <stdio.h>
#include <unistd.h>
int main()
{
int returnVal = fork();
printf("Return Value: %i\n", returnVal);
return 1;
}
当我编译这个和运行,我得到我已经给只有一个printf语句,则下面的输出 为什么我看到2个打印。如果我删除了打印,则不会打印任何内容。
[email protected]:~/Projects/Nix$ ./a.out
Return Value: 5547
Return Value: 0
您确定您已阅读过'man fork'吗? –
您正在使用'fork';你期望什么? –
为什么我的问题投下了票? –