_getpid

Ottiene l'identificazione del processo.

Importante

Non è possibile usare questa API nelle applicazioni eseguite in Windows Runtime. Per altre informazioni, vedere Funzioni CRT non supportate nelle app della piattaforma UWP (Universal Windows Platform).

Sintassi

int _getpid( void );

Valore restituito

Restituisce l'ID processo ottenuto dal sistema. Non viene restituito alcun errore.

Osservazioni:

La funzione _getpid ottiene l'ID processo dal sistema. L'ID processo identifica in modo univoco il processo chiamante.

Requisiti

Ciclo Intestazione obbligatoria
_getpid <process.h>

Per altre informazioni sulla compatibilità, vedere Compatibility (Compatibilità).

Esempio

// 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

Vedi anche

Processo e controllo dell'ambiente
_mktemp, _wmktemp