FindFirst Function

Microchip MDD File System Interface

MDDFS Interface Library Help
FindFirst Function
C
int FindFirst(
    const char * fileName, 
    unsigned int attr, 
    SearchRec * rec
);
Description

The FindFirst function will search for a file based on parameters passed in by the user. This function will use the FILEfind function to parse through the current working directory searching for entries that match the specified parameters. If a file is found, its parameters are copied into the SearchRec structure, as are the initial parameters passed in by the user and the position of the file entry in the current working directory.

Preconditions

None

Parameters
Parameters 
Description 
fileName 
The name to search for
  • Parital string search characters
  • * - Indicates the rest of the filename or extension can vary (e.g. FILE.*)
  • ? - Indicates that one character in a filename can vary (e.g. F?LE.T?T)

 

attr 
The attributes that a found file may have

 

rec 
pointer to a structure to put the file information in 
Return Values
Return Values 
Description 
File was found 
-1 
No file matching the specified criteria was found 
Side Effects

Search criteria from previous FindFirst call on passed SearchRec object will be lost. The FSerrno variable will be changed.

Remarks

Call FindFirst or FindFirstpgm before calling FindNext

Microchip MDD File System Interface 1.2.0 - [Aug 18, 2008]
Copyright © 2008 Microchip Technology, Inc.  All rights reserved.