c에서 간단한 실행파일 만들때요 자신의 프로세스 아이디 찍을수

kknd345의 이미지

c에서 간단한 실행파일 만들때요 자신의 프로세스 아이디 찍을수 있나요?

환경은 리눅스입니다.

카二리의 이미지

Quote:

NAME
getpid, getppid - get process identification

SYNOPSIS
#include <unistd.h>

pid_t getpid(void);
pid_t getppid(void);

DESCRIPTION
getpid returns the process ID of the current process.
(This is often used by routines that generate unique tem?
porary file names.)

getppid returns the process ID of the parent of the cur?
rent process.

CONFORMING TO
POSIX, BSD 4.3, SVID

새 생각 :)