fgetpwent
Section: C Library Functions (3)
Updated: 2026-02-08
Index
JM Home Page
roff page
名前
fgetpwent - パスワードファイルエントリーの取り出し
ライブラリ
標準 C ライブラリ (libc,~-lc)
書式
#include <stdio.h>
#include <sys/types.h>
#include <pwd.h>
struct passwd *fgetpwent(FILE *stream);
glibc 向けの機能検査マクロの要件 (feature_test_macros(7) 参照):
fgetpwent():
glibc 2.19 以降:
_DEFAULT_SOURCE
glibc 2.19 以前:
_SVID_SOURCE
説明
fgetpwent() 関数は、stream から得られた行を分解したフィールド を含む構造体へのポインターを返す。
最初に呼び出された時には最初のエントリーを返し、それ以降は 次のエントリーを返す。 stream で参照されるファイルは
/etc/passwd と同じ形式でなければならない (passwd(5) 参照)。
passwd 構造体は、<pwd.h> で以下のように定義されている:
struct passwd {
char *pw_name; /* ユーザー名 */
char *pw_passwd; /* ユーザーのパスワード */
uid_t pw_uid; /* ユーザー ID */
gid_t pw_gid; /* グループ ID */
char *pw_gecos; /* 実名 */
char *pw_dir; /* ホームディレクトリ */
char *pw_shell; /* シェルプログラム */
};
返り値
The fgetpwent() function returns a pointer to a passwd 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
-
passwd 構造体に割り当てるメモリーが十分なかった。
ファイル
- /etc/passwd
-
パスワードデータベースファイル
属性
この節で使用されている用語の説明については、 attributes(7) を参照。
| インターフェース | 属性 | 値
|
|
fgetpwent()
| Thread safety | MT-Unsafe race:fgetpwent
|
標準規格
なし。
歴史
SVr4.
関連項目
endpwent(3), fgetpwent_r(3), fopen(3), getpw(3), getpwent(3),
getpwnam(3), getpwuid(3), putpwent(3), setpwent(3), passwd(5)
Index
- 名前
-
- ライブラリ
-
- 書式
-
- 説明
-
- 返り値
-
- エラー
-
- ファイル
-
- 属性
-
- 標準規格
-
- 歴史
-
- 関連項目
-
This document was created by
man2html,
using the manual pages.