|
|
|
drs_util - Directory Scanning Utilities.c files in
a directory:
#include <stdio.h> -- Standard I/O definitions.
#include "drs_util.h" -- Directory scanning utilities.
...
int main (int argc, char *argv[])
{
char *fileName ;
DirectoryScan scan ;
drsCreate ("*.c", &scan) ;
fileName = drsFirst (scan) ;
while (fileName != NULL) {
printf ("C File: %s\n", fileName) ;
fileName = drsNext (scan) ;
}
drsDestroy (scan) ;
}
Alternatively, you can call drsGet() to get the
I-th name in the directory:
...
for (i = 0 ; i < drsCount (scan) ; i++)
printf ("C File: %s\n", drsGet (scan, i)) ;
...
fsearch()
routine. Farewell, VMS!
drsCount() - returns the number of files in a directory scan.
drsCreate() - creates a directory scan.
drsDestroy() - destroys a directory scan.
drsFirst() - gets the first entry in the directory.
drsGet() - gets the I-th entry in the directory.
drsNext() - gets the next entry in the directory.
drs_util.c
drs_util.h
(See libgpl for the
complete source, including support routines and build files.)