getegid() — Get the effective group ID

Standards

Standards / Extensions C or C++ Dependencies
POSIX.1
XPG4
XPG4.2
Single UNIX Specification, Version 3
both  

Format

#define _POSIX_SOURCE
#include <unistd.h>

gid_t getegid(void);

General description

Finds the effective group ID (GID) of the calling process.

Returned value

Returns the effective group ID (GID). It is always successful.

There are no documented errno values.

Example

CELEBG04
/* CELEBG04

   This example finds the group ID.

 */
#define _POSIX_SOURCE
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>

main() {
  printf("my group id is %d\n", (int) getgid());
}

Output
my group id is 500

Related information