|Important||This document may not represent best practices for current development, links to downloads and other resources may no longer be valid. Current recommended version can be found here. ArchiveDisclaimer|
_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 );
- Target file specification (may include wildcards).
- File information buffer.
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:
- File specification that could not be matched.
- 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|
|_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.
All versions of the C run-time libraries.