telldir() — Current location of directory stream

Standards

Standards / Extensions C or C++ Dependencies

XPG4
XPG4.2
Single UNIX Specification, Version 3

both  

Format

#define _XOPEN_SOURCE
#include <dirent.h>

long telldir(DIR *dirp);

General description

The telldir() function obtains the current location associated with the directory stream specified by dirp.

If the most recent operation on the directory stream was a seekdir(), then the directory position returned from telldir() is the same as that supplied as a loc argument to seekdir().

Returned value

If successful, telldir() returns the current location of the specified directory stream.

If the dirp argument supplied is NULL or invalid, telldir() returns -1 and sets errno to one of the following values:
Error Code
Description
EBADF
The dirp argument was invalid.

Related information