telldir

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

名前

telldir - ディレクトリストリーム中の現在位置を返す  

ライブラリ

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

書式

#include <dirent.h>

long telldir(DIR *dirp);

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

telldir():

    _XOPEN_SOURCE
       || /* glibc >= 2.19: */ _DEFAULT_SOURCE
       || /* glibc <= 2.19: */ _BSD_SOURCE || _SVID_SOURCE
 

説明

telldir() 関数は、ディレクトリストリーム dirp の現在位置を返す。  

返り値

On success, the telldir() function returns the current location in the directory stream. On error, -1 is returned, and errno is set to indicate the error.  

エラー

EBADF
ディレクトリストリームディスクリプター dirp が無効である。
 

属性

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

標準規格

POSIX.1-2008.  

歴史

POSIX.1-2001, 4.3BSD.

Up to glibc 2.1.1, the return type of telldir() was off_t. POSIX.1-2001 specifies long, and this is the type used since glibc 2.1.2.

初期のファイルシステムでは、 telldir() が返す値は単なるディレクトリ内のファイルオフセットであった。最近のファイルシステムでは、ディレクトリを表現するのに、フラットなテーブルではなく、ツリー構造やハッシュ構造が使用されている。このようなファイルシステムでは、 telldir() が返す値 (および readdir(3) が内部で使用する値) は、ファイルシステム実装がディレクトリ内での位置を得るのに使用する "cookie" となる。アプリケーションプログラムでは、必ずこの値を内容の意識せず単なる値として扱うべきであり、その内容について前提を持つべきでは「ない」。  

関連項目

closedir(3), opendir(3), readdir(3), rewinddir(3), scandir(3), seekdir(3)


 

Index

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

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