_findfirst, _findfirsti64, _wfindfirst, _wfindfirsti64

Visual Studio 6.0

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.


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:


File specification that could not be matched


Invalid filename specification



Target file specification (may include wildcards)


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