putgrent - write a group database entry to a file
Contents
Attributes
For an explanation of the terms used in this section, see attributes(7).
┌─────────────────────────────────────────────────────────────────────────────┬───────────────┬─────────┐
│ Interface │ Attribute │ Value │
├─────────────────────────────────────────────────────────────────────────────┼───────────────┼─────────┤
│ putgrent() │ Thread safety │ MT-Safe │
└─────────────────────────────────────────────────────────────────────────────┴───────────────┴─────────┘
Description
The putgrent() function is the counterpart for fgetgrent(3). The function writes the content of the
provided structgroup into the stream. The list of group members must be NULL-terminated or NULL-
initialized.
The structgroup is defined as follows:
struct group {
char *gr_name; /* group name */
char *gr_passwd; /* group password */
gid_t gr_gid; /* group ID */
char **gr_mem; /* group members */
};
Library
Standard C library (libc, -lc)
Name
putgrent - write a group database entry to a file
Return Value
The function returns zero on success, and a nonzero value on error.
See Also
fgetgrent(3), getgrent(3), group(5) Linux man-pages 6.9.1 2024-05-02 putgrent(3)
Standards
GNU.
Synopsis
#define_GNU_SOURCE /* See feature_test_macros(7) */ #include<grp.h>intputgrent(conststructgroup*restrictgrp,FILE*restrictstream);
