FileFindClose
FileFindClose
函数关闭搜索处理。
void FileFindClose(
long search_handle // 搜索处理程序
);参量
- search_handle
[in] 搜索处理,通过 FileFindFirst()恢复。
返回值
无值返回。
注释
函数必须调用到空出来的系统资源。
示例:
//--- 启动脚本时启动输入参数的窗口
#property script_show_inputs
//--- 过滤器
input string InpFilter="*";
//+------------------------------------------------------------------+
//| 脚本程序启动函数 |
//+------------------------------------------------------------------+
void OnStart()
{
string file_name;
int i=1;
//--- 在本地文件夹根目录下接收搜索句柄
long search_handle=FileFindFirst(InpFilter,file_name);
//--- 检查FileFindFirst()函数是否成功执行
if(search_handle!=INVALID_HANDLE)
{
//--- 检查循环中传递的字符串是否是文件或目录名称
do
{
ResetLastError();
//--- 如果是文件,函数将返回true,如果是目录,函数将生成错误5018。
FileIsExist(file_name);
PrintFormat("%d : %s name = %s",i,GetLastError()==5018 ? "Directory" : "File",file_name);
i++;
}
while(FileFindNext(search_handle,file_name));
//--- 关闭搜索句柄
FileFindClose(search_handle);
}
else
Print("Files not found!");
}