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

📄 forkdemo3.c

📁 unix linux 编程实践源代码
💻 C
字号:
/*  forkdemo3.c - shows how the return value from fork() *                allows a process to determine whether *                it is a child or process */#include	<stdio.h>main(){	int	fork_rv;	printf("Before: my pid is %d\n", getpid());	fork_rv = fork();		/* create new process	*/	if ( fork_rv == -1 )		/* check for error	*/		perror("fork");	else if ( fork_rv == 0 )		printf("I am the child.  my pid=%d\n", getpid());	else		printf("I am the parent. my child is %d\n", fork_rv);}

⌨️ 快捷键说明

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