Skip to content

Latest commit

 

History

History
73 lines (58 loc) · 2.08 KB

File metadata and controls

73 lines (58 loc) · 2.08 KB
title ms.custom ms.date ms.reviewer ms.suite ms.technology ms.tgt_pltfrm ms.topic apiname apilocation apitype f1_keywords dev_langs helpviewer_keywords ms.assetid caps.latest.revision author ms.author manager
_getpid | Microsoft Docs
11/04/2016
cpp-standard-libraries
article
_getpid
msvcrt.dll
msvcr80.dll
msvcr90.dll
msvcr100.dll
msvcr100_clr0400.dll
msvcr110.dll
msvcr110_clr0400.dll
msvcr120.dll
msvcr120_clr0400.dll
ucrtbase.dll
api-ms-win-crt-runtime-l1-1-0.dll
DLLExport
_getpid
C++
getpid function
_getpid function
process identification numbers
d3e13bae-9a0c-4f33-86d3-ec9df9519285
20
corob-msft
corob
ghogen

_getpid

Gets the process identification.

Important

This API cannot be used in applications that execute in the Windows Runtime. For more information, see CRT functions not supported with /ZW.

Syntax

int _getpid( void );  

Return Value

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.

Requirements

Routine Required header
_getpid <process.h>

For more compatibility information, see Compatibility.

Example

// crt_getpid.c  
// This program uses _getpid to obtain  
// the process ID and then prints the ID.  
  
#include <stdio.h>  
#include <process.h>  
  
int main( void )  
{  
   // If run from command line, shows different ID for   
   // command line than for operating system shell.  
  
   printf( "Process id: %d\n", _getpid() );  
}  
Process id: 3584  

See Also

Process and Environment Control
_mktemp, _wmktemp