Horje
get pid c Code Example
get pid c
#include <stdio.h>
#include <stdlib.h>
int main()
{
    int pid;
    printf("1) before the fork\n");
    pid = fork();
    printf("2) after the fork\n");
    if (pid == 0)
    {
        printf("3) i am the child process, my pid is %d\n", getpid());
        printf("my parent has the pid %d\n", getppid());
        exit(1);
    }
    else
    {
        printf("i am the parent process, my pid is %d\n", getpid());
        printf("my parent has the pid %d\n", getppid());
        exit(0); //the father of the father is the terminal
    }
}
// THIS ONLY WORKS ON LINUX




C

Related
comnetar toda linha do vs code Code Example comnetar toda linha do vs code Code Example
how to auto run something on cmd Code Example how to auto run something on cmd Code Example
pip install sklearn specific version Code Example pip install sklearn specific version Code Example
comentar linhas vscode Code Example comentar linhas vscode Code Example
como programar a area de um triangulo em c Code Example como programar a area de um triangulo em c Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
10