fgetgrent

Section: C Library Functions (3)
Updated: 2026-02-08
Index JM Home Page roff page
 

名前

fgetgrent - グループファイルエントリーの取り出し  

ライブラリ

標準 C ライブラリ (libc,~-lc)  

書式

#include <stdio.h>
#include <sys/types.h>
#include <grp.h>

struct group *fgetgrent(FILE *stream);

glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):

fgetgrent():

    glibc 2.19 以降:
        _DEFAULT_SOURCE
    glibc 2.19 以前:
        _SVID_SOURCE
 

説明

fgetgrent() 関数は、 stream で参照されるファイルから取り出したグループ情報 を含む構造体へのポインターを返す。最初に呼び出された時は 最初のエントリーを返し、それ以降は、次のエントリーを返す。 stream で参照されるファイルは、 /etc/group と同じ形式でなければならない (group(5) 参照)。

group 構造体は <grp.h> で以下のように定義されている:

struct group {
    char   *gr_name;        /* グループ名 */
    char   *gr_passwd;      /* グループのパスワード */
    gid_t   gr_gid;         /* グループ ID */
    char  **gr_mem;         /* グループのメンバ名へのポインター
                               の配列 (配列はヌルで終端する) */
};
 

返り値

The fgetgrent() function returns a pointer to a group structure, or NULL if there are no more entries or an error occurs. In the event of an error, errno is set to indicate the error.  

エラー

ENOMEM
group 構造体を割り当てるためのメモリーが不十分。
 

属性

この節で使用されている用語の説明については、 attributes(7) を参照。
インターフェース属性値
fgetgrent() Thread safetyMT-Unsafe race:fgetgrent
 

標準規格

なし。  

歴史

SVr4.  

関連項目

endgrent(3), fgetgrent_r(3), fopen(3), getgrent(3), getgrgid(3), getgrnam(3), putgrent(3), setgrent(3), group(5)


 

Index

名前
ライブラリ
書式
説明
返り値
エラー
属性
標準規格
歴史
関連項目

This document was created by man2html, using the manual pages.