Standards / Extensions | C or C++ | Dependencies |
---|---|---|
POSIX.1 |
both |
#define _POSIX_SOURCE
#include <unistd.h>
gid_t getgid(void);
Finds the real group ID (GID) of the calling process.
Returns the real group ID of the calling process. It is always successful.
There are no documented errno values.
⁄* CELEBG07
This example gets the real group ID.
*⁄
#define _POSIX_SOURCE
#include <sys⁄types.h>
#include <stdio.h>
#include <unistd.h>
main() {
printf("my group id is %d\n", (int) getgid());
}
my group id is 500