libdragon
Loading...
Searching...
No Matches
Data Structures | Functions
dir.h File Reference

Directory handling. More...

Go to the source code of this file.

Data Structures

struct  dir_t
 Directory entry structure. More...
 

Macros

Directory entry type definitions
#define DT_REG   1
 Regular file.
 
#define DT_DIR   2
 Directory.
 

Functions

int dir_findfirst (const char *const path, dir_t *dir)
 Find the first file in a directory.
 
int dir_findnext (const char *const path, dir_t *dir)
 Find the next file in a directory.
 

Detailed Description

Directory handling.

Function Documentation

◆ dir_findfirst()

int dir_findfirst ( const char *const  path,
dir_t dir 
)

Find the first file in a directory.

This function should be called to start enumerating a directory or whenever a directory enumeration should be restarted.

Parameters
[in]pathPath to the directory structure
[out]dirDirectory entry structure to populate with first entry
Returns
0 on successful lookup or a negative value on error.

◆ dir_findnext()

int dir_findnext ( const char *const  path,
dir_t dir 
)

Find the next file in a directory.

After finding the first file in a directory using dir_findfirst, call this to retrieve the rest of the directory entries. Call this repeatedly until a negative error is returned signifying that there are no more directory entries in the directory.

Parameters
[in]pathPath to the directory structure
[out]dirDirectory entry structure to populate with next entry
Returns
0 on successful lookup or a negative value on error.