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
16 The fgetpwent() function returns a pointer to a structure containing
17 the broken out fields of a line in the file stream. The first time it
18 is called it returns the first entry; thereafter, it returns successive
19 entries. The file stream must have the same format as /etc/passwd.
20
21 The passwd structure is defined in <pwd.h> as follows:
22
23 struct passwd {
24 char *pw_name; /* user name */
25 char *pw_passwd; /* user password */
26 uid_t pw_uid; /* user ID */
27 gid_t pw_gid; /* group ID */
28 char *pw_gecos; /* real name */
29 char *pw_dir; /* home directory */
30 char *pw_shell; /* shell program */
31 };
32
34 The fgetpwent() function returns the passwd structure, or NULL if there
35 are no more entries or an error occurs.
36
38 ENOMEM Insufficient memory to allocate passwd structure.
39
41 /etc/passwd
42 password database file
43
45 SVr4
46
48 endpwent(3), fgetpwent_r(3), getpw(3), getpwent(3), getpwnam(3), getp‐
49 wuid(3), putpwent(3), setpwent(3), passwd(5)
50
51
52
53GNU 1996-05-17 FGETPWENT(3)