【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.10.14 FindFiles
Contents
Description
List all files in specified folder with specified file extension, or with file name with wild characters.
Syntax
BOOL FindFiles( StringArray & saResult, LPCSTR lpcszPath, LPCSTR lpcszFileOrExt = NULL, bool bCheckExist = false, int nRecurseLevel = 0 )
Parameters
- saResult
- [output] the referrence of string array will receive the finding results
- lpcszPath
- [input] the file path to search for files
- lpcszFileOrExt
- [input] the file extension to search for, or file name with extension. Wildcard characters allowed. NULL means find all files.
- bCheckExist
- [input] true will check the given saReult to see if the file is already in that array
- nRecurseLevel
- [input] level of recursive. If zero then do not recursive, if -1 then recursive all.
Return
Returns TRUE for success, otherwise FALSE.
Examples
EX1
void FindFiles_ex1() { //1. path and extension supplied string strExePath = GetAppPath(); StringArray saResult; FindFiles(saResult, strExePath, "otw"); int ii; printf("FindFiles(saResult, strExePath, \"otw\")\n"); for (ii = 0;ii<saResult.GetSize();ii++) { out_str(saResult[ii]); } //2. just path supplied, find all files. FindFiles(saResult, strExePath, "*.*"); printf("FindFiles(saResult, strExePath, \"*.*\")\n"); for (ii = 0;ii<saResult.GetSize();ii++) { out_str(saResult[ii]); } // the same as 2 FindFiles(saResult, strExePath); printf("FindFiles(saResult, strExePath)\n"); for (ii = 0;ii<saResult.GetSize();ii++) { out_str(saResult[ii]); } //3. strWildNameWithExt contains filename (with wildchar(s)), and extension. string strWildNameWithExt = "a*c?e.ext"; FindFiles(saResult, strExePath, strWildNameWithExt); printf("FindFiles(saResult, strExePath, strWildNameWithExt)\n"); for (ii = 0;ii<saResult.GetSize();ii++) { out_str(saResult[ii]); } }
Remark
See Also
Header to Include
origin.h