setgrent(), endgrent() - group database operations
#include <grp.h>
void endgrent (void)
int setgrent (void)
These functions (along with getgrnam(2), getgrgid(2), and getgrent(2)) operate on the group database (traditionally /etc/group, but part of the user database in Interix). Each line of the database is defined by the structure group found in the include file <grp.h>:
struct group {
char *gr_name; /* group name */
gid_t gr_gid; /* group id */
char **gr_mem; /* group members */
char *gr_passwd; /* group password */
};
The setgrent(2) function opens the file, or rewinds it if it is already open.
The endgrent(2) function closes any open files.
The function setgrent(2) returns the value 1 if successful, otherwise the value 0 is returned. The function endgrent(2) has no return value.
getgrent(2)
getgrnam(2)
getgrgid(2)
getpwent(2)