Chapter Contents

Previous

Next
getgrent

getgrent



Access Group Database Sequentially

Portability: UNIX compatible


SYNOPSIS
DESCRIPTION
RETURN VALUE
USAGE NOTES
RELATED FUNCTIONS


SYNOPSIS

#include <sys/types.h>
#include <grp.h>
struct group *getgrent(void);


DESCRIPTION

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

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


RETURN VALUE

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


USAGE NOTES

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


RELATED FUNCTIONS

endgrent, getgrgid, getgrnam, setgrent


Chapter Contents

Previous

Next

Top of Page

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