Search
 
SCRIPT & CODE EXAMPLE
 

C

pid of a process in c

#include <stdio.h>
#include <stdlib.h>

int main()
{
    int pid = 0;
    printf("before the fork 
");
    pid = fork(); //create the child process
    printf("after the fork 
");
    if (pid == 0)
    {
        printf("I'm the child process, my pid is &d
", getpid());
        exit(1);
    }
    else
    {
        printf("I'm the parent process, my pid is &d
", getpid());
        exit(0);
    }
}
Comment

c program to print pid of a process

Process ID: 1298
Parent Process ID: 879
Comment

PREVIOUS NEXT
Code Example
C :: convert char number to int in c 
C :: KneesDev 
C :: sockaddr_in c 
C :: imprimir matriz 
C :: how to merge 2 bytes into an integer 
C :: cifras de un numero en c 
C :: lxc Failed to load config for 
C :: ex: C hello world 
C :: wifi access point in esp8266 
C :: stddef.h 
C :: command args c 
C :: working outside of application context 
C :: c unused parameter 
C :: how to print logs when doing unit-testing in rust 
C :: c calling a function 
C :: c malloc 
C :: linux_reboot_magic2 
C :: android studio sdkmanager always accept 
C :: Syntax for creating a node 
C :: How to include multiline conditional inside template literal 
C :: insertNode 
C :: how to make C program blink on screen 
C :: clipboard lib 
C :: My name is c 
C :: diiferent between * and & in c 
C :: timespec c 
C :: what to do after autoencoder training 
C :: Calculate the area of a circle and modify the same program to calculate the volume of a cylinder given its radius and height. 
C :: payement des véhicules a la sortie de station de langue c 
C :: i765 OPT filing fees october 2 
ADD CONTENT
Topic
Content
Source link
Name
5+5 =