gtpc2m3sC/C++ Language Support User's Guide

getgid-Get the Real Group ID

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

Format

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

Normal Return

The getgid function returns the real group ID of the calling process. It is always successful.

Error Return

Not applicable.

Programming Considerations

None.

Examples

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

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

The getgid function returns the following information for the group ID of the calling function.

My Group ID is 100

Related Information