Name
getpid - Returns a process identification number.
Syntax
#include <process.h>
int getpid(void)
Description
The getpid function returns an integer (the process ID) that
uniquely identifies the calling process.
Return Value
The getpid function returns the process ID. There is no
error return.
See Also
mktemp(S)
Example
#include <process.h> #include <string.h> #include <stdio.h>
char filename[9], pid[5];
main()
{
strcpy(filename, "FILE");
strcat(filename, itoa(getpid(), pid,10));
/* Prints "FILExxxxx", where xxxxx */
/* is the process ID: */
printf("Filename is %s\n", filename);
}
This program uses getpid to obtain the process ID, then
converts the process ID to a string for output.
(printed 6/18/89)