Condividi tramite


_getpid

Ottiene l'identificatore del processo.

Importante

Questa API non può essere utilizzata nelle applicazioni che vengono eseguite in Windows Runtime.Per ulteriori informazioni, vedere Funzioni CRT non supportate con /ZW.

int _getpid( void );

Valore restituito

Restituisce l'ID del processo ottenuto dal sistema. Nessun ritorno di errore.

Note

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

Requisiti

Routine

Intestazione obbligatoria

_getpid

<process.h>

Per ulteriori informazioni sulla compatibilità, vedere 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() );
}
  

Equivalente .NET Framework

System::Diagnostics::Process::Id

Vedere anche

Riferimenti

Controllo processo e ambiente

_mktemp, _wmktemp