【お知らせ】この部分は英語原文のみでの提供となります。何卒ご了承ください。
2.1.10.12 FindClose
Contents
Description
The FindClose function closes the specified search handle. The FindFirstFile and FindNextFile functions use the search handle to locate files with names that match a given name.
Syntax
BOOL FindClose( HANDLE hFindFile )
Parameters
- hFindFile
- [input] Search handle returned by a previous call to the FindFirstFile function.
Return
If the function succeeds, return true; else return false.
Examples
EX1
int FindClose_ex1() { // case1: List all file under c: string strPath = "c:\\*.*"; FindClose_dir(strPath); return 1; } // a DOS dir command // can type into ScriptWindow "dir c:\*.*", for example. // void FindClose_dir(string strFile) { WIN32_FIND_DATAA find; HANDLE hFile; //out_str(strFile); int nCount = 0; if((hFile=FindFirstFile(strFile,&find)) != INVALID_HANDLE_VALUE) { out_str(find.cFileName); nCount++; while(FindNextFile(hFile,&find)) { out_str(find.cFileName); nCount++; } printf("%d files found\n",nCount); FindClose(hFile); // must close the handle } else printf("%s: file(s) not found\n",strFile); }
Remark
See Also
Header to Include
origin.h