Chapter Contents

Previous

Next
getpwent

getpwent



Access user Database Sequentially

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
USAGE NOTES
RELATED FUNCTIONS


SYNOPSIS

#include <sys/types.h>
#include <pwd.h>
struct passwd *getpwent(void);


DESCRIPTION

The getpwent function is used to read the system database defining all UNIX System Services users. The first call to getpwent returns the first defined user, and each successive call returns information about the next user in the database. After information about the last user is obtained, getpwent returns 0 to indicate the end of file. When 0 is returned, the file position is reset, so that the next call to getpwent will retrieve the first database entry.

Note:   It is more efficient to use the getpwuid or getpwnam function to obtain information about a specific user, rather than a loop calling getpwent. getpwent is provided mainly as an aid to porting existing UNIX programs that use it.  [cautionend]


RETURN VALUE

getpwent returns a pointer to a struct passwd if successful, and the end of the user database has not been reached. getpwent returns 0 if the end of the database has been reached, or if an error condition occurred. See the function description for getpwuid for more information about the definition of struct passwd.


USAGE NOTES

The getpwent function can only be used with MVS 5.2.2 or a later release.


RELATED FUNCTIONS

endpwent, getpwnam, getpwuid, setpwent


Chapter Contents

Previous

Next

Top of Page

Copyright © 2001 by SAS Institute Inc., Cary, NC, USA. All rights reserved.