# dirent.h - [Overview](#section736132765165626) - [Summary](#section118574325165626) - [Data Structures](#nested-classes) - [Typedefs](#typedef-members) - [Functions](#func-members) ## **Overview** **Related Modules:** [FS](fs.md) **Description:** Provides functions and structures used for performing file system operations, including file read/write, directory traversal, and file system mounting. **Since:** 1.0 **Version:** 1.0 ## **Summary** ## Data Structures

Data Structure Name

Description

dirent

Defines the content of the directory.

## Typedefs

Typedef Name

Description

DIR

typedef struct __dirstream

Opens the handle of the folder directory.

## Functions

Function

Description

closedir (DIR *dirp)

int

Closes a specified directory.

opendir (const char *dirname)

DIR *

Opens a specified directory.

readdir (DIR *dirp)

struct dirent *

Reads a specified directory.

readdir_r (DIR *__restrict dirp, struct dirent *__restrict entry, struct dirent **__restrict result)

int

Reads a specified directory (thread-safe version).

rewinddir (DIR *dirp)

void

Resets a directory stream read position.

alphasort (const struct dirent **a, const struct dirent **b)

int

Sorts the directory entries in alphabetical order.

scandir (const char *dir, struct dirent ***namelist, int(*sel)(const struct dirent *), int(*compar)(const struct dirent **, const struct dirent **))

int

Scans directory to find the target entries.

seekdir (DIR *dirp, long offset)

void

Sets the position of the next readdir call in the directory stream.

telldir (DIR *dirp)

long

Obtains the current position in the specified directory stream.