1FGETGRENT(3)               Linux Programmer's Manual              FGETGRENT(3)
2
3
4

NAME

6       fgetgrent - get group file entry
7

SYNOPSIS

9       #include <stdio.h>
10       #include <sys/types.h>
11       #include <grp.h>
12
13       struct group *fgetgrent(FILE *stream);
14
15   Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17       fgetgrent():
18           Since glibc 2.19:
19               _DEFAULT_SOURCE
20           Glibc 2.19 and earlier:
21               _SVID_SOURCE
22

DESCRIPTION

24       The  fgetgrent()  function  returns a pointer to a structure containing
25       the group information from the file referred to by stream.   The  first
26       time  it  is  called it returns the first entry; thereafter, it returns
27       successive entries.  The file referred to by stream must have the  same
28       format as /etc/group (see group(5)).
29
30       The group structure is defined in <grp.h> as follows:
31
32           struct group {
33               char   *gr_name;        /* group name */
34               char   *gr_passwd;      /* group password */
35               gid_t   gr_gid;         /* group ID */
36               char  **gr_mem;         /* NULL-terminated array of pointers
37                                          to names of group members */
38           };
39

RETURN VALUE

41       The  fgetgrent()  function  returns  a pointer to a group structure, or
42       NULL if there are no more entries or an error occurs.  In the event  of
43       an error, errno is set to indicate the cause.
44

ERRORS

46       ENOMEM Insufficient memory to allocate group structure.
47

ATTRIBUTES

49       For  an  explanation  of  the  terms  used  in  this  section,  see at‐
50       tributes(7).
51
52       ┌────────────┬───────────────┬──────────────────────────┐
53Interface   Attribute     Value                    
54       ├────────────┼───────────────┼──────────────────────────┤
55fgetgrent() │ Thread safety │ MT-Unsafe race:fgetgrent │
56       └────────────┴───────────────┴──────────────────────────┘

CONFORMING TO

58       SVr4.
59

SEE ALSO

61       endgrent(3), fgetgrent_r(3), fopen(3), getgrent(3), getgrgid(3), getgr‐
62       nam(3), putgrent(3), setgrent(3), group(5)
63

COLOPHON

65       This  page  is  part of release 5.10 of the Linux man-pages project.  A
66       description of the project, information about reporting bugs,  and  the
67       latest     version     of     this    page,    can    be    found    at
68       https://www.kernel.org/doc/man-pages/.
69
70
71
72GNU                               2017-09-15                      FGETGRENT(3)
Impressum