Syntax
#include <process.h> int getpid(void);Description
getpid gets the process identifier that uniquely identifies the calling process.
Note: In earlier releases of C Set ++, getpid began with an underscore (_getpid). Because it is defined by the X/Open standard, the underscore has been removed. For compatibility, The Developer's Toolkit will map _getpid to getpid for you.
getpid function the process identifier as an integer value. There is no error return value.
This example prints the process identifier:
#include <process.h> #include <string.h> #include <stdio.h> #include <stdlib.h> int main(void) { printf("Process identifier is %05d\n", getpid()); return 0; /**************************************************************************** The output should be similar to: Process identifier is 00242 ****************************************************************************/ }Related Information