User`s manual

Dynamic C Users Manual digi.com 161
But, if you want the next active file and do not care about the file’s other attributes, mode should be
(FAT_INC_ACTIVE | FATATTR_READ_ONLY | FATATTR_HIDDEN | FATATTR_SYSTEM |
FATATTR_ARCHIVE). This search would only exclude directory and label entries.
Now suppose you want only the next active read-only file, leaving out hidden or system files. The next
group of macros allows this search by filtering on whether the requested attribute is set. The filter macros
are:
FAT_FIL_RD_ONLY - filter on read-only attribute
FAT_FIL_HIDDEN - filter on hidden attribute
FAT_FIL_SYSTEM - filter on system attribute
FAT_FIL_LABEL - filter on label attribute
FAT_FIL_DIR - filter on directory attribute
FAT_FIL_ARCHIVE - filter on modified attribute
If you set mode to (FAT_INC_ACTIVE | FATATTR_READ_ONLY | FAT_FIL_RD_ONLY |
FATATTR_ARCHIVE), the result will be the next active file that has its read-only attribute set (and has
the archive attribute in either state).
NOTE: If you have FAT version 2.05 or earlier, you do not have access to the
FAT_FIL_* macros.
Default Search Flags
To make things easier, there are two predefined mode flags. Each one may be used alone or in combination
with the macros already described.
FAT_INC_ALL - selects any directory entry of any type.
FAT_INC_DEF - selects the next active file or directory entry, including read-only or archived files.
No hidden, system, label, deleted, or empty directories or files will be selected. This is typically what
you see when you do a directory listing on your PC.
Search Flag Examples
Here are some more examples of how the flags work.
1. If you want the next hidden file or directory:
Start with the FAT_INC_DEF macro default flag. This flag does not allow hidden files, so we
need
FATATTR_HIDDEN. Then to narrow the search to consider only a hidden file or directory,
we need the macro FAT_FIL_HIDDEN to filter on files or directories that have the hidden
attribute set. That is, mode is set to:
FAT_INC_DEF | FATATTR_HIDDEN | FAT_FIL_HIDDEN