C language Getgid () function: Get the group recognition code function
Header file:
#include <unistd.h> #include <sys/types.h>
To define a function:
Function Description: Getgid () is used to obtain the group identifier that executes the current process.
Return value: Return group identification code
Example
#include <unistd.h>
#include <sys/types.h>
main ()
{
printf ("GID is%d\n", Getgid ());
}
Perform:
GID is 0//When executing the sample program with root identity
C language Getegid () function: Get Group identification code
Header file:
#include <unistd.h> #include <sys/types.h>
To define a function:
Function Description: Getegid () is used to obtain a valid group identifier for the execution of the current process. A valid group identifier is used to determine the permissions of a group when a process executes.
Return value: Returns a valid group identification code.
Example
#include <unistd.h>
#include <sys/types.h>
main ()
{
printf ("Egid is%d\n", Getegid ());
}
Perform:
Egid is 0//When executing the sample program with root identity