_getpid

Gets the process identification.

int _getpid( void );

Routine Required Header Compatibility
_getpid <process.h> Win 95, Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

_getpid returns the process ID obtained from the system. There is no error return.

Remarks

The _getpid function obtains the process ID from the system. The process ID uniquely identifies the calling process.

Example

/* GETPID.C: This program uses _getpid to obtain
 * the process ID and then prints the ID.
 */

#include <stdio.h>
#include <process.h>

void main( void )
{
   /* If run from command line, shows different ID for 
    * command line than for operating system shell.
    */
   printf( "\nProcess id: %d\n", _getpid() );
}

Output

Process id: 193

Process and Environment Control Routines

See Also   _mktemp