findnext, _wfindnext

De RAD Studio
Aller à : navigation, rechercher

Remonter à dir.h - Index


Header File

io.h, wchar.h

Category

Directory Control Routines

Prototype

long _findnext(long handle, struct _finddata_t *fileinfo);

long __wfindnext(long handle, struct _wfinddata_t *fileinfo);

Description

Finds subsequent files, if any, that match the filter argument in a previous call to _findfirst/__wfindfirst. Then, _findnext/__wfindnext updates the fileinfo structure with the necessary information for continuing the search. One file name for each call to _tfindnext is returned until no more files are found in the directory matching the pathname (filter).

The handle parameter is the search handle returned by a previous call to _findfirst. The fileinfo parameter is the file information buffer.

These functions are 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 <stdio.h>
#include <dir.h>
void print_dir(wchar_t* dir_name)
{
  /* Open a find stream (_wfinddata_t and a find handle) */ 
  _wffblk find_data;
  int done;

  done = _wfindfirst(dir_name, &find_data, 0);

  /* Scan all files that mach */
  while (!done)
  {
    printf("%ls\n", find_data.ff_name);
    done = _wfindnext(&find_data);
  }

  /* Close the find handle */
  _wfindclose(&find_data);
}


Portability

POSIX Win32 ANSI C ANSI C++

_findnext

+

__wfindnext

NT only



Voir aussi