www.delorie.com/djgpp/doc/libc-2.01/libc_343.html   search  
Go to the first, previous, next, last section, table of contents.


getpwent

Syntax

#include <pwd.h>

struct passwd *getpwent(void);

Description

This function retrieves the next available password file entry. For MS-DOS, this is simulated by providing exactly one entry:

struct passwd {
  char * pw_name;    /* getlogin() */
  int    pw_uid;     /* getuid() */
  int    pw_gid;     /* getgid() */
  char * pw_dir;     /* "/" or getenv("HOME") */
  char * pw_shell;   /* "/bin/sh" or getenv("SHELL") */
};

Return Value

The next passwd entry, or NULL if there are no more.

Example

struct passwd *p;
setpwent();
while ((p = getpwent()) != NULL)
{
  printf("user %s name %s\n", p->pw_name, p->pw_gecos);
}
endpwent();


Go to the first, previous, next, last section, table of contents.

  prev next   webmaster     delorie software   privacy  
  Copyright © 1997     Updated Apr 1997