gtpc2m3oC/C++ Language Support User's Guide

getegid-Get the Effective Group ID

This function gets the effective group ID (GID) of the calling function's process.

Format

#include <unistd.h>
gid_t getegid(void);

Normal Return

The getegid function returns the effective group ID. It is always successful.

Error Return

Not applicable.

Programming Considerations

None.

Examples

The following example provides information for the effective group ID of the caller:

#include <unistd.h>
#include <stdio.h>
 
int main(void) {
 
  printf("My group id is %d\n", (int) getegid() );
  return 0;
}

The example output from the getegid function obtains the effective group ID and places it in variable type gid_t.

My group id is 100

Related Information