_findnexti64, _wfindnexti64

From RAD Studio
Jump to: navigation, search

Go Up to io.h Index


Header File

io.h, wchar.h

Category

Directory Control Routines

Prototype

long _findnexti64(long handle, struct _finddatai64_t *fileinfo);

__int64 _wfindnexti64(long handle, struct _wfinddata_t *fileinfo);

Description

Finds subsequent files, if any, that match the filter argument in a previous call to _findfirsti64/_wfindfirsti64. Then, _findnexti64/_wfindnexti64 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 i64 versions are for 64 bit filesize use and 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 <io.h>
void print_dir(wchar_t* dir_name)
{
  /* Open a find stream (_wfinddatai64_t and a find handle) */
  _wfinddatai64_t find_data;
  long handle = _wfindfirsti64(dir_name, &find_data);

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

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

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

Portability

POSIX Win32 ANSI C ANSI C++

_findnexti64

+

_wfindnexti64

NT only