wFindFirst Function

MDD File System Interface Library

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

Initial search function for the 'fileName' in UTF16 format on PIC24/PIC32/dsPIC devices. The wFindFirst 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.If the return value of the function is 0 then "utf16LFNfoundLength" indicates whether the file found was long file name or short file name(8P3 format). The "utf16LFNfoundLength" is non-zero for long file name and is zero for 8P3 format."utf16LFNfound" points to the address of long file name if found during the operation.

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
  • ATTR_READ_ONLY - File may be read only
  • ATTR_HIDDEN - File may be a hidden file
  • ATTR_SYSTEM - File may be a system file
  • ATTR_VOLUME - Entry may be a volume label
  • ATTR_DIRECTORY - File may be a directory
  • ATTR_ARCHIVE - File may have archive attribute
  • ATTR_MASK - All attributes
 
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 wFindFirst call on passed SearchRec object will be lost. "utf16LFNfound" is overwritten after subsequent wFindFirst/FindNext operations.It is the responsibility of the application to read the "utf16LFNfound" before it is lost.The FSerrno variable will be changed.

Remarks

Call FindFirst or FindFirstpgm before calling FindNext

Microchip MDD File System Interface 1.4.2 - [Oct 15, 2012]
Copyright © 2012 Microchip Technology, Inc.  All rights reserved.