1FGETPWENT(3) Linux Programmer's Manual FGETPWENT(3)
2
3
4
6 fgetpwent - get password file entry
7
9 #include <stdio.h>
10 #include <sys/types.h>
11 #include <pwd.h>
12
13 struct passwd *fgetpwent(FILE *stream);
14
15 Feature Test Macro Requirements for glibc (see feature_test_macros(7)):
16
17 fgetpwent(): _SVID_SOURCE
18
20 The fgetpwent() function returns a pointer to a structure containing
21 the broken out fields of a line in the file stream. The first time it
22 is called it returns the first entry; thereafter, it returns successive
23 entries. The file referred to by stream must have the same format as
24 /etc/passwd (see passwd(5)).
25
26 The passwd structure is defined in <pwd.h> as follows:
27
28 struct passwd {
29 char *pw_name; /* username */
30 char *pw_passwd; /* user password */
31 uid_t pw_uid; /* user ID */
32 gid_t pw_gid; /* group ID */
33 char *pw_gecos; /* real name */
34 char *pw_dir; /* home directory */
35 char *pw_shell; /* shell program */
36 };
37
39 The fgetpwent() function returns a pointer to a passwd structure, or
40 NULL if there are no more entries or an error occurs.
41
43 ENOMEM Insufficient memory to allocate passwd structure.
44
46 /etc/passwd
47 password database file
48
50 SVr4.
51
53 endpwent(3), fgetpwent_r(3), fopen(3), getpw(3), getpwent(3), getpw‐
54 nam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5)
55
57 This page is part of release 3.22 of the Linux man-pages project. A
58 description of the project, and information about reporting bugs, can
59 be found at http://www.kernel.org/doc/man-pages/.
60
61
62
63GNU 2008-07-10 FGETPWENT(3)