⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 fork.c

📁 linux文件I-O exit.c fork.c select.c write.c waitpid.c execlp.c execle.c
💻 C
字号:
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>
#include <stdlib.h>

int main(void)
{
	pid_t result;
	result = fork();
	if(result == -1)
	{
		perror("fork");
		exit;
	}
	else if(result == 0)
	{
		printf("The return value is %d\n In child process!!\n My PID is %d\n",result,getpid());
	}
	else
	{
		printf("The return value is %d\n In father process!!\n My PID is %d\n",result,getpid());
	}
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -