Export (0) Print
Expand All
div
Expand Minimize
3 out of 20 rated this helpful - Rate this topic

_findfirst, _findfirst64, _findfirsti64, _wfindfirst, _wfindfirst64, _wfindfirsti64

Provide information about the first instance of a filename that matches the file specified in the filespec argument.

intptr_t _findfirst(
   const char *filespec,
   struct _finddata_t *fileinfo 
);
intptr_t _findfirst64(
   const char *filespec,
   struct __finddata64_t *fileinfo 
);
intptr_t _findfirsti64(
   const char *filespec,
   struct _finddatai64_t *fileinfo 
);
intptr_t _wfindfirst(
   const wchar_t *filespec,
   struct _wfinddata_t *fileinfo 
);
intptr_t _wfindfirst64(
   const wchar_t *filespec,
   struct __wfinddata64_t *fileinfo 
);
intptr_t _wfindfirsti64(
   const wchar_t *filespec,
   struct _wfinddatai64_t *fileinfo 
);

Parameters

filespec
Target file specification (may include wildcards).
fileinfo
File information buffer.

Return Value

If successful, _findfirst returns a unique search handle identifying the file or group of files matching the filespec specification, which can be used in a subsequent call to _findnext, or to _findclose. Otherwise, _findfirst will return –1 and set errno to one of the following values:

ENOENT
File specification that could not be matched.
EINVAL
Invalid filename specification.

See _doserrno, errno, _sys_errlist, and _sys_nerr for more information on these, and other, return codes.

You must call _findclose after you are finished using either the _findfirst or _findnext function. This will free up resources used by these functions in your application.

_findfirst64, which uses the __finddata64_t structure, and _wfindfirst64, which use the __wfinddata64_t structure, allows file-creation dates to be expressed up through 23:59:59, December 31, 3000, UTC, whereas the other functions only represent dates through 19:14:07 January 18, 2038, UTC. Midnight, January 1, 1970, is the lower bound of the date range for all these functions.

Generic-Text Routine Mappings

TCHAR.H routine _UNICODE & _MBCS not defined _MBCS defined _UNICODE defined
_tfindfirst _findfirst _findfirst _wfindfirst
_tfindfirsti64 _findfirsti64 _findfirsti64 _wfindfirsti64
_tfindfirst64 _findfirst64 _findfirst64 _wfindfirst64

Requirements

Function Required header Compatibility
_findfirst <io.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_findfirst64 <io.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_findfirsti64 <io.h> Win 98, Win Me, Win NT, Win 2000, Win XP
_wfindfirst <io.h> or <wchar.h> Win NT, Win 2000, Win XP
_wfindfirst64 <io.h> or <wchar.h> Win NT, Win 2000, Win XP
_wfindfirsti64 <io.h> or <wchar.h> Win NT, Win 2000, Win XP

For additional compatibility information, see Compatibility in the Introduction.

Libraries

All versions of the C run-time libraries.

See Also

System Calls Routines | _find, _wfind Function Overview | Run-Time Routines and .NET Framework Equivalents

Show:
© 2014 Microsoft. All rights reserved.