DosFindFirst
typedef struct _FDATE { /* fdate */
unsigned day : 5; /* binary day for directory entry */
unsigned month : 4; /* binary month for directory entry */
unsigned year : 7; /* binary year for directory entry */
} FDATE;
typedef struct _FTIME { /* ftime */
unsigned twosecs : 5; /* binary number of two-second increments */
unsigned minutes : 6; /* binary number of minutes */
unsigned hours : 5; /* binary number of hours */
} FTIME;
typedef struct _FILEFINDBUF { /* findbuf */
FDATE fdateCreation; /* file date of creation */
FTIME ftimeCreation; /* file time of creation */
FDATE fdateLastAccess; /* file date of last access */
FTIME ftimeLastAccess; /* file time of last access */
FDATE fdateLastWrite; /* file date of last write */
FTIME ftimeLastWrite; /* file time of last write */
ULONG cbFile; /* file end of data */
ULONG cbFileAlloc; /* file allocation */
USHORT attrFile; /* file attribute */
UCHAR cchName; /* length of ASCIIZ name string */
CHAR achName[CCHMAXPATHCOMP]; /* ASCIIZ name string */
} FILEFINDBUF;
#define INCL_DOSFILEMGR
USHORT rc = DosFindFirst(FileName, DirHandle, Attribute, ResultBuf,
ResultBufLen, SearchCount, Reserved);
PSZ FileName; /* File path name */
PHDIR DirHandle; /* Directory search handle */
USHORT Attribute; /* Search attribute */
PFILEFINDBUF ResultBuf; /* Result buffer */
USHORT ResultBufLen; /* Result buffer length *
PUSHORT SearchCount; /* Number of entries to find */
ULONG 0; /* Reserved (must be zero) */
USHORT rc; /* return code */
Example
This example searches for a file matching the pattern 'te??.dat.'
#define INCL_DOSFILEMGR
#define NORMAL_FILES 0
#define HIDDEN_FILES 2
#define SEARCH_PATTERN "te??.dat"
#define FILE_ATTRIBUTE NORMAL_FILES | HIDDEN_FILES
#define RESERVED 0L
HDIR FindHandle;
FILEFINDBUF FindBuffer;
USHORT FindCount;
USHORT rc;
FindHandle = 0x0001;
FindCount = 1;
rc = DosFindFirst(SEARCH_PATTERN, /* File pattern */
&FindHandle, /* Directory search handle */
FILE_ATTRIBUTE, /* Search attribute */
&FindBuffer, /* Result buffer */
sizeof(FindBuffer), /* Result buffer length */
&FindCount, /* # of entries to find */
RESERVED); /* Reserved (must be zero) */
Created using Inf-PHP v.2 (c) 2003 Yuri Prokushev
Created using Inf-HTML v.0.9b (c) 1995 Peter Childs