Nut/OS  5.0.5
API Reference
Reading Directories

UNIX compatible directory read functions. More...

Collaboration diagram for Reading Directories:

Functions

DIRopendir (const char *name)
 Open a directory stream.
int closedir (DIR *dir)
 Close a directory stream.
struct direntreaddir (DIR *dir)
 Get the next directory entry.

Detailed Description

UNIX compatible directory read functions.


Function Documentation

DIR* opendir ( const char *  name)

Open a directory stream.

Opens a directory and associates a directory stream with it.

Parameters:
namePathname of the directory. Must be the full pathname including the device, because Nut/OS doesn't support relative paths.
Returns:
A pointer used to identify the directory stream in subsequent operations. NULL is returned if the directory cannot be accessed, or if it cannot allocate enough memory.

References _dirdesc::dd_buf, _dirdesc::dd_len, _NUTDEVICE::dev_ioctl, ENODEV, ENOMEM, errno, free(), FS_DIR_OPEN, malloc(), memset(), NutDeviceLookup(), strcpy(), and strlen().

Referenced by NutFtpTransferDirectoryOptions().

Here is the call graph for this function:

int closedir ( DIR dir)

Close a directory stream.

Closes the given directory stream and frees any allocated memory.

Parameters:
dirPointer to the directory stream.
Returns:
0 on success. On failure, -1 is returned and the global variable errno is set to indicate the error.

References _dirdesc::dd_buf, _dirdesc::dd_fd, _NUTDEVICE::dev_ioctl, free(), FS_DIR_CLOSE, and _NUTFILE::nf_dev.

Referenced by NutFtpTransferDirectoryOptions().

Here is the call graph for this function:

struct dirent* readdir ( DIR dir) [read]

Get the next directory entry.

Parameters:
dirPointer to the directory stream.
Returns:
A pointer to the next directory entry. It returns NULL upon reaching the end of the directory.

References _dirdesc::dd_buf, _dirdesc::dd_fd, _NUTDEVICE::dev_ioctl, FS_DIR_READ, and _NUTFILE::nf_dev.

Referenced by NutFtpTransferDirectoryOptions().