_findclose

De RAD Studio
Aller à : navigation, rechercher

Remonter à io.h - Index


Header File

io.h

Category

Directory Control Routines

Prototype

int _findclose(long handle);

Description

Closes the specified search handle and releases associated resources associated with previous calls to findfirst/findnext. The handle parameter is the search handle returned by the previous call to _findfirst.

This function is provided for Microsoft compatibility.

Return Value

On success, returns 0.

Otherwise, returns –1 and sets errno to:

ENOENTFile specification that could not be matched

Example

#include <io.h>
void print_dir(wchar_t* dir_name)
{
  /* Open a find stream (_wfinddata_t and a find handle) */
  _wfinddata_t find_data;
  long handle = __wfindfirst(dir_name, &find_data);

  /* Check for errors */
  if (!handle)
    return;

  /* Scan all files that match */
  do
  {
    printf("%ls\n", find_data.name);
  } while (!__wfindnext(handle, &find_data));

  /* Close the find handle */
  _findclose(handle);
}


Portability

POSIX Win32 ANSI C ANSI C++

_findclose

+


Voir aussi