Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 8 Next »

An application stores information in a file system by creating a file or appending new information to an existing file. At a later time, this information may be retrieved by reading the file. However, if a certain file must be found, or all files may be listed, the application can iterate through the entries in a directory using the directory access (or simply directory) functions. The available directory functions are listed in .

A separate set of directory operations (or entry) functions manage the files and directories available on the system. Using these functions, the application can create, delete and rename directories, and get and set a directory’s attributes and date/time. More information about the entry functions can be found in File System Entry Access Functions.

The entry functions and the directory Open() function accept one or more full directory paths. For information about using file and path names, see µC/FS File and Directory Names and Paths.

The functions listed in Table 9-1 are core functions in the directory access module (FSDir_####() functions). These are matched by API level functions that correspond to standard C or POSIX functions. More information about the API-level functions can be found in Chapter 10, “POSIX API”. The core and API functions provide basically the same functionality; the benefits of the former are enhanced capabilities, a consistent interface and meaningful return error codes.

Directory Access Functions

The directory access functions provide an API for iterating through the entries within a directory. The FSDir_Open() function initiates this procedure, and each subsequent call to FSDir_Rd() (until all entries have been examined) returns a FS_DIRENT which holds information about a particular entry. The FSDir_Close() function releases any file system structures and locks.

These functions are almost exact equivalents to POSIX API functions; the primary difference is the advantage of valuable return error codes to the application.

Directory Module Function

POSIX API Equivalent

For more information about and an example of using directories, see section 10-4 “Directory Access Functions”.

  • No labels