Gets the process identification.
#include <process.h> | Required only for function declarations |
int _getpid( void );
The _getpid function returns the process ID, an integer that uniquely identifies the calling process.
The _getpid function returns the process ID. There is no error return.
Standards:UNIX
16-Bit:DOS, QWIN, WIN, WIN DLL
32-Bit:DOS32X
Use _getpid for compatibility with ANSI naming conventions of non-ANSI functions. Use getpid and link with OLDNAMES.LIB for UNIX compatibility.
/* 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 DOS, shows different ID for DOS than for DOS shell.
* If execed or spawned, shows ID of parent.
*/
printf( "\nProcess id of parent: %d\n", _getpid() );
}
Process id of parent: 828