DosFindNext

DosFindNext

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[13];           /* ASCIIZ name string */
 
} FILEFINDBUF;

#define INCL_DOSFILEMGR

USHORT  rc = DosFindNext(DirHandle, ResultBuf, ResultBufLen, SearchCount);

HDIR             DirHandle;     /* Directory handle */
PFILEFINDBUF     ResultBuf;     /* Result buffer */
USHORT           ResultBufLen;  /* Result buffer length */
PUSHORT          SearchCount;   /* Number of entries to find */

USHORT           rc;            /* return code */

Example

This example gets the 1st file in the current directory, and then gets the next file.

#define INCL_DOSFILEMGR

#define NORMAL_FILES 0
#define SEARCH_PATTERN "*.*"
#define FILE_ATTRIBUTE NORMAL_FILES
#define RESERVED 0L

HDIR        FindHandle;
FILEFINDBUF FindBuffer;
USHORT      FindCount;
USHORT      rc;

   FindHandle = 0x0001;
   FindCount = 1;

   if(!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) */
      rc = DosFindNext(FindHandle,         /* Directory handle */
                       &FindBuffer,        /* Result buffer */
                       sizeof(FindBuffer), /* Result buffer length */
                       &FindCount);        /* # of entries to find */


[Back: DosFindFirst2]
[Next: DosFlagProcess]