dosfirst, dosnext
Purpose
Finds DOS files that match a pattern.
Library
DOS Services Library (libdos.a)
Syntax
#include <dos.h>
char *dosfirst (srch, pattern, mode) char *dosnext (srch)
DOSFIND *srch; DOSFIND *srch;
char *pattern;
long mode;
Description
The dosfirst and dosnext subroutines return a pointer to
a memory area containing a file name that matches the
pattern specified by the pattern parameter and that has
the attributes specified by the mode parameter.
The pattern parameter is a file path name that can
contain the pattern-matching characters "?" (question
mark) and "*" (asterisk).
The srch parameter points to a DOSFIND structure. That
same DOSFIND structure should be passed to the dosnext
subroutine on subsequent uses of the dosnext subroutine.
The mode parameter contains flags that specify files to
include in the search. If the mode parameter is 0,
directories, hidden files, and DOS system files are
omitted from the search. You can use the following flags
OR-ed together in any combination:
S_DIR Includes directories in the search.
S_HIDDEN Includes DOS/AIX hidden files in the search.
S_SYSTEM Includes DOS system files in the search.
S_REG Includes regular DOS files (all files other
than directories, hidden files, or system
files).
S_ALL Includes all files (directories, hidden
files, system files, and regular files).
DOSFIND is defined in the dos.h header file and has the
following format:
typedef long DOSMODE;
typedef short DOSFILE;
typedef struct
{
long seek;
int count;
long *disk;
int mode;
int tnxtcl;
} dossrch;
typedef struct
{
long mode;
char path[128];
char *base;
char *extn;
char is_dos;
DOSFILE handle;
short index;
dossrch dos_srch;
} DOSFIND;
A return of NULL from either subroutine indicates that no
more files matching the pattern can be found. If the
search is terminated before the NULL return occurs, you
should use the free subroutine to free the memory area
returned from the last call.
Related Information
"DOS services library."