#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;
}
C/C++: linux下获取进程ID,父进程ID
于 2014-06-26 15:46:54 首次发布