#include <iostream>
#include <sys/types.h>
#include <unistd.h>
#include <stdio.h>

using namespace std;

int main()
{

    pid_t pid, ppid;
    pid = getpid();
    ppid = getppid();


    cout << "pid" <<pid<< endl;
    cout << "ppid" <<ppid << endl;
    return 0;
}

更多推荐