go_winter_2024/cmd/test.cpp
2024-12-21 12:42:35 +03:00

20 lines
332 B
C++

// C++ Code to demonstrate getppid()
#include <iostream>
#include <unistd.h>
using namespace std;
// Driver Code
int main()
{
int pid;
pid = fork();
if (pid == 0)
{
cout << "\nParent Process id : "
<< getpid() << endl;
cout << "\nChild Process with parent id : "
<< getppid() << endl;
}
return 0;
}