Share via


_findfirst, _findfirsti64, _wfindfirst, _wfindfirsti64

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

long_findfirst(char*filespec,struct_finddata_t*fileinfo);

__int64_findfirsti64(char*filespec,struct_finddata_t*fileinfo);

long_wfindfirst(wchar_t*filespec,struct_wfinddata_t*fileinfo);

__int64_wfindfirsti64(wchar_t*filespec,struct_wfinddata_t*fileinfo);

Function Required Header Compatibility
_findfirst <io.h> Win 95, Win NT
_findfirsti64 <io.h> Win 95, Win NT
_wfindfirst <io.h> or <wchar.h> Win NT
_wfindfirsti64 <io.h> or <wchar.h> Win NT

For additional compatibility information, see Compatibility in the Introduction.

Libraries

LIBC.LIB Single thread static library, retail version
LIBCMT.LIB Multithread static library, retail version
MSVCRT.LIB Import library for MSVCRT.DLL, retail version

Return Value

If successful, _findfirst and _wfindfirst return 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 _wfindnext, respectively, or to _findclose. Otherwise, _findfirst and _wfindfirst return –1 and set errno to one of the following values:

ENOENT

File specification that could not be matched

EINVAL

Invalid filename specification

Parameters

filespec

Target file specification (may include wildcards)

fileinfo

File information buffer

Generic-Text Routine Mappings

TCHAR.H Routine _UNICODE & _MBCS Not Defined _MBCS Defined _UNICODE Defined
_tfindfirst _findfirst _findfirst _wfindfirst
_tfindfirsti64 _findfirsti64 _findfirsti64 _wfindfirsti64

System Calls Routines_find, _wfind Function Overview