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. In the event of
41 an error, errno is set to indicate the cause.
42
44 ENOMEM Insufficient memory to allocate passwd structure.
45
47 /etc/passwd
48 password database file
49
51 SVr4.
52
54 endpwent(3), fgetpwent_r(3), fopen(3), getpw(3), getpwent(3), getpw‐
55 nam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5)
56
58 This page is part of release 3.53 of the Linux man-pages project. A
59 description of the project, and information about reporting bugs, can
60 be found at http://www.kernel.org/doc/man-pages/.
61
62
63
64GNU 2013-04-19 FGETPWENT(3)