The GNU C Library - Lookup Group

Node: Lookup Group Next: Scanning All Groups Prev: Group Data Structure Up: Group Database

Looking Up One Group

You can search the group database for information about a specific group using getgrgid or getgrnam . These functions are declared in `grp.h'.

Function struct group * getgrgid (gid_t gid)
This function returns a pointer to a statically-allocated structure containing information about the group whose group ID is gid. This structure may be overwritten by subsequent calls to getgrgid .

A null pointer indicates there is no group with ID gid.

Function struct group * getgrnam (const char *name)
This function returns a pointer to a statically-allocated structure containing information about the group whose group name is name. This structure may be overwritten by subsequent calls to getgrnam .

A null pointer indicates there is no group named name.


Next: Scanning All Groups Up: Group Database