getpid -- Get Process Identifier

Format

#include <process.h>
int getpid(void);

Language Level: XPG4, Extension
getpid gets the process identifier that uniquely identifies the calling process.

Note: In earlier releases of the C/C++ run-time library, getpid began with an underscore (_getpid). Because it is defined by the X/Open standard, the underscore has been removed. For compatibility, IBM C and C++ Compilers will map _getpid to getpid for you.

Return Value
getpid function gets the process identifier as an integer value. There is no error return value.

Example
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
   ************************************************/
}


_cwait -- Wait for Child Process
execl - _execvpe -- Load and Run Child Process
_spawnl - _spawnvpe -- Start and Run Child Processes
<process.h>