getpwent

Returns information about a user in the directory.

Library:LibC
Classification:POSIX
Service:File and Directory I/O

Syntax

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

Return Values

If successful, returns a pointer to a passwd structure. Otherwise, returns a NULL pointer if no more entries are found or an error occurs. If an error occurs, errno is also set.

Decimal

Constant

Description

105

ENOCONTEXT

The calling thread has no context.

Remarks

The getpwent function can be used enumerate all users in the directory. The first call returns information about the first user in the system. Subsequent calls enumerate the other users. However, the function isn't reentrant and subsequent calls to the getpwuid, getpwnam, or getpwent functions might overwrite any results returned.

See Also