#include <sys/types.h>
#include <unistd.h>
pid_t getpid(void);
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
#include <stdlib.h>
int main(void)
{
pid_t pid;
if ( (pid = fork()) == -1 ) {
printf("fork error!\n");
exit(1);
}
if( pid == 0 )
printf("getpid return %d\n", getpid());
exit(0);
}
beyes@linux-beyes:~/C/base> ./getpid.exe
getpid return 19395
欢迎光临 曲径通幽论坛 (http://www.groad.net/bbs/) | Powered by Discuz! X3.2 |