| Description | The function ffind searches for files that match specific patterns. The function is included in the RL-FlashFS library. The prototype is defined in the file rtl.h. The parameter pattern is a character pointer specifying the searching rule. The parameter can include: - A drive prefix.
| Drive Prefix | Storage Medium |
|---|
| "" | Default System drive as specified in the file File_Config.c | | "F:" or "F0:" | Flash drive | | "S:" or "S0:" | SPI Flash drive | | "R:" or "R0:" | RAM drive | | "M:" or "M0:" | Memory Card drive 0 | | "M1:" | Memory Card drive 1 | | "U:" or "U0:" | USB Flash drive 0 | | "U1:" | USB Flash drive 1 | | "N:" or "N0:" | NAND Flash drive |
- The wildcard *.
| Pattern | Description |
|---|
| "*" or "*.*" | Searches for all files in the directory | | "abc*" | Searches for files that begin with abc | | "*.htm" | Searches for files that end with .htm | | "abc*.text" | Searches for files that begin with abc and that end with .text |
The parameter info is a pointer to a structure that stores information about the matching files.
|
| Example |
#include <rtl.h>
void file_directory (void) {
FINFO info;
info.fileID = 0; /* info.fileID must be set to 0 */
while (ffind ("R:*.*", &info) == 0) { /* find whatever is in drive "R0:" */
printf ("\n%-32s %5d bytes, ID: %04d",
info.name,
info.size,
info.fileID);
}
if (info.fileID == 0) {
printf ("\nNo files...");
}
}
|