ch3-pid (Process ID)
Chapter_3 | system |
print-pid.c ALP, p. 50-51
#include <stdio.h> // for printf()
#include <unistd.h> // for getpid(), getppid()
int main()
{
printf ("The process ID is %d\n", (int) getpid());
printf ("The parent process ID is %d\n", (int) getppid());
return 0;
}
/*
gcc print-pid.c -o print-pid
./print-pid
The process ID is 75713
The parent process ID is 75593
./print-pid
The process ID is 77557
The parent process ID is 75593
*/
Chapter_3 | BACK_TO_TOP | system |
Comments
Post a Comment